@mdfriday/foundry
Version:
The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.
86 lines • 2.4 kB
TypeScript
import { Path as IPath, PathType } from '../type';
import { PathComponentsImpl } from '../vo/pathcomponents';
/**
* Path entity implementation
* Represents a parsed path with all its components and operations
*/
export declare class Path implements IPath {
private readonly components;
private _unnormalized?;
private shouldTrimLeadingSlash;
constructor(components: PathComponentsImpl);
component(): string;
path(): string;
name(): string;
nameNoExt(): string;
nameNoLang(): string;
dir(): string;
ext(): string;
lang(): string;
section(): string;
sections(): string[];
container(): string;
containerDir(): string;
base(): string;
baseNoLeadingSlash(): string;
baseNameNoIdentifier(): string;
nameNoIdentifier(): string;
pathNoLang(): string;
pathNoIdentifier(): string;
pathRel(owner: IPath): string;
baseRel(owner: IPath): string;
trimLeadingSlash(): IPath;
identifier(index: number): string;
identifiers(): string[];
bundleType(): PathType;
isContent(): boolean;
isBundle(): boolean;
isBranchBundle(): boolean;
isLeafBundle(): boolean;
isHTML(): boolean;
disabled(): boolean;
forBundleType(type: PathType): IPath;
unnormalized(): IPath;
private setShouldTrimLeadingSlash;
private norm;
private isContentPage;
private baseInternal;
private identifierAsString;
private identifierIndex;
private escapeRegExp;
toString(): string;
/**
* Check if two paths are equal
*/
equals(other: IPath): boolean;
/**
* Get a hash code for this path
*/
hashCode(): string;
}
/**
* Utility functions for working with Path instances
*/
export declare class PathUtils {
/**
* Create a path from string components
*/
static fromString(component: string, path: string): Path;
/**
* Check if a path has a specific extension
*/
static hasExtension(path: IPath, extension: string): boolean;
/**
* Check if child path is under parent path
*/
static isUnder(child: IPath, parent: IPath): boolean;
/**
* Get the relative path from one path to another
*/
static relativeTo(from: IPath, to: IPath): string;
/**
* Compare two paths for sorting
*/
static compare(a: IPath, b: IPath): number;
}
//# sourceMappingURL=path.d.ts.map