import { DocometInspectableObjectClass } from '../docomet-inspectable.js'; import globModule from 'fast-glob'; /** * PathSplit */ export type DocometPathSplit = (this: void, path: string) => string[]; /** * PathJoin */ export type DocometPathJoin = (this: void, ...paths: string[]) => string; /** * Path */ export declare class DocometPath extends DocometInspectableObjectClass { #private; /** * Root path */ static get rootPath(): string; /** * Returns current working directory * @returns Current working directory */ static cwd(): string; /** * Finds file or directory up directory tree * @param name Name to find * @param startPath Path to start searching from * @returns Absolute path to found item, or `undefined` if not found */ static findUp(name: string, startPath?: string): string | undefined; /** * Checks if path exists * @param path Path * @returns `true` if exists, otherwise `false` */ static exists(path: string): boolean; /** * Checks if path does not exist * @param path Path * @returns `true` if does not exist, otherwise `false` */ static doesNotExist(path: string): boolean; /** * Returns absolute path * @param path Path * @returns Absolute path */ static absolute(path: string): string; /** * Returns relative path from root path * @param toPath To path * @param fromPath From path * @returns Relative path */ static relative(toPath: string, fromPath?: string): string; /** * Normalizes path * @param path Path * @returns Normalized path */ static normalize(path: string): string; /** * Splits path by platform separator * @param path Path * @returns Split path */ static split(this: void, path: string): string[]; /** * Splits path by posix separator * @param path Path * @returns Split path */ static splitPosix(this: void, path: string): string[]; /** * Joins paths by platform separator * @param paths Paths * @returns Joined path */ static join(this: void, ...paths: string[]): string; /** * Joins paths by posix separator * @param paths Paths * @returns Joined path */ static joinPosix(this: void, ...paths: string[]): string; /** * Rebuilds path using split and join functions * @param path Path * @param split Split function * @param join Join function * @returns Rebuilt path */ static rebuild(this: void, path: string, split: DocometPathSplit, join: DocometPathJoin): string; /** * Finds files using glob patterns asynchronously * @param patterns Glob patterns * @param options `Options` object from `fast-glob` * @returns Matched file paths or `Entry` objects from `fast-glob` */ static globAsync(patterns: string | string[], options?: globModule.Options): Promise; /** * Finds files using glob patterns synchronously * @param patterns Glob patterns * @param options `Options` object from `fast-glob` * @returns Matched file paths or `Entry` objects from `fast-glob` */ static glob(patterns: string | string[], options?: globModule.Options): string[] | globModule.Entry[]; /** * Parses path string into `DocometPath` instance * @param path Path string * @returns `DocometPath` instance */ static parse(path: string): DocometPath; /** * Creates new `DocometPath` instance * @param args Constructor arguments * @returns `DocometPath` instance */ static new(...args: ConstructorParameters): DocometPath; /** * Directory path */ get dir(): string; /** * File name without extension */ get name(): string; /** * File extension with leading dot */ get ext(): string; /** * Full file name */ get base(): string; /** * Creates `DocometPath` instance * @param dir Directory path * @param name File name * @param ext File extension */ constructor(dir: string, name?: string, ext?: string); /** * Creates new `DocometPath` instance with updated properties * @param updates Updated properties * @returns `DocometPath` instance */ with( updates: Partial<{ dir: string; name: string; ext: string; }> ): DocometPath; /** * Converts to string * @returns String representation */ toString(): string; /** * Converts to posix string * @returns Posix string representation */ toPosixString(): string; /** * Converts to JSON object * @returns JSON representation */ toJSON(): string; }