@mdfriday/foundry
Version:
The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.
140 lines • 3.73 kB
TypeScript
import { PathFactory, PathParserConfig, PathPool, Path as IPath, PathComponents } from '../type';
/**
* PathFactoryImpl implements the PathFactory interface
* Provides methods for creating Path instances
*/
export declare class PathFactoryImpl implements PathFactory {
private processor;
private pool?;
constructor(config?: PathParserConfig, pool?: PathPool);
/**
* Create a Path from component and path string
*/
create(component: string, path: string, config?: PathParserConfig): IPath;
/**
* Create a Path from PathComponents
*/
createFromComponents(components: PathComponents): IPath;
/**
* Create multiple paths from an array of path strings
*/
createMany(component: string, paths: string[], config?: PathParserConfig): IPath[];
/**
* Create a path with custom configuration
*/
createWithConfig(component: string, path: string, normalizeConfig?: {
toLowerCase?: boolean;
replaceSpaces?: boolean;
customNormalizer?: (path: string) => string;
}): IPath;
}
/**
* DefaultPathFactory provides a default configured path factory
*/
export declare class DefaultPathFactory extends PathFactoryImpl {
constructor();
}
/**
* SimplePathPool implements PathPool interface for basic object pooling
*/
export declare class SimplePathPool implements PathPool {
private pool;
private maxSize;
constructor(maxSize?: number);
get(): IPath;
put(path: IPath): void;
/**
* Clear all paths from the pool
*/
clear(): void;
/**
* Get current pool size
*/
size(): number;
}
/**
* PathBuilder provides a fluent interface for building paths
*/
export declare class PathBuilder {
private component;
private path;
private config;
private factory;
constructor(factory?: PathFactory);
/**
* Set the component
*/
withComponent(component: string): PathBuilder;
/**
* Set the path
*/
withPath(path: string): PathBuilder;
/**
* Enable/disable normalization
*/
withNormalization(normalize: boolean): PathBuilder;
/**
* Enable/disable space replacement
*/
withSpaceReplacement(replaceSpaces: boolean): PathBuilder;
/**
* Set custom normalizer
*/
withNormalizer(normalizer: (path: string) => string): PathBuilder;
/**
* Build the path
*/
build(): IPath;
/**
* Reset builder to initial state
*/
reset(): PathBuilder;
}
/**
* Static factory methods for common path creation scenarios
*/
export declare class PathFactoryUtils {
private static defaultFactory;
/**
* Create a content path
*/
static createContentPath(path: string): IPath;
/**
* Create a static resource path
*/
static createStaticPath(path: string): IPath;
/**
* Create a layout path
*/
static createLayoutPath(path: string): IPath;
/**
* Create an archetype path
*/
static createArchetypePath(path: string): IPath;
/**
* Create a data path
*/
static createDataPath(path: string): IPath;
/**
* Create a theme path
*/
static createThemePath(path: string): IPath;
/**
* Create paths from a configuration object
*/
static createFromConfig(config: {
component: string;
paths: string[];
normalize?: boolean;
replaceSpaces?: boolean;
}): IPath[];
/**
* Get a path builder instance
*/
static builder(): PathBuilder;
/**
* Create a path with pooling
*/
static createWithPool(component: string, path: string, pool: PathPool): IPath;
}
//# sourceMappingURL=pathfactory.d.ts.map