UNPKG

@mdfriday/foundry

Version:

The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.

130 lines 3.91 kB
import { PathProcessor, PathParserConfig, PathNormalizer, FileExtensionChecker, StringIdentity } from '../type'; import { Path } from '../entity/path'; /** * PathProcessorImpl implements the PathProcessor interface * Main entry point for path processing operations */ export declare class PathProcessorImpl implements PathProcessor { private normalizer; private extChecker; constructor(normalizer?: PathNormalizer, extChecker?: FileExtensionChecker); /** * Parse a path with component information */ parse(component: string, path: string): Path; /** * Parse and return only the identity */ parseIdentity(component: string, path: string): StringIdentity; /** * Parse and return base and base name without identifier */ parseBaseAndBaseNameNoIdentifier(component: string, path: string): [string, string]; /** * Create PathComponents from path information */ private createPathComponents; /** * Detect bundle type based on filename and component */ private detectBundleType; /** * Check if file is a content file based on extension */ private isContentFile; /** * Get file extension without dot */ private getFileExtension; /** * Calculate positions for different path parts * Exact replica of Go version - parse from right to left */ private calculatePathPositions; /** * Extract identifiers from filename (extensions and language codes) */ private extractIdentifiers; } /** * PathParsingNormalizer implements normalization rules specifically for path parsing * Uses per-space-to-dash conversion for maintaining exact Hugo path behavior */ export declare class PathParsingNormalizer implements PathNormalizer { readonly toLowerCase: boolean; readonly replaceSpaces: boolean; constructor(toLowerCase?: boolean, replaceSpaces?: boolean); normalize(path: string): string; } /** * BasicPathNormalizer implements Hugo's basic normalization rules */ export declare class BasicPathNormalizer implements PathNormalizer { readonly toLowerCase: boolean; readonly replaceSpaces: boolean; constructor(toLowerCase?: boolean, replaceSpaces?: boolean); normalize(path: string): string; } /** * DefaultFileExtensionChecker implements basic file extension checking */ export declare class DefaultFileExtensionChecker implements FileExtensionChecker { isContentExt(ext: string): boolean; isHTML(ext: string): boolean; hasExt(path: string): boolean; } /** * ConfigurablePathNormalizer allows custom normalization rules */ export declare class ConfigurablePathNormalizer implements PathNormalizer { private rules; constructor(config?: PathParserConfig); normalize(path: string): string; /** * Add a custom normalization rule */ addRule(rule: (path: string) => string): void; /** * Clear all rules */ clearRules(): void; } /** * Path parsing utilities */ export declare class PathParserUtils { /** * Parse a path string into basic components */ static parseBasic(path: string): { dir: string; name: string; ext: string; nameWithoutExt: string; }; /** * Join path segments */ static join(...segments: string[]): string; /** * Normalize a path string using basic rules */ static normalizeBasic(path: string): string; /** * Check if a path represents a bundle */ static isBundle(path: string): boolean; /** * Extract section from path */ static extractSection(path: string): string; /** * Remove extension from path */ static removeExtension(path: string): string; /** * Check if path has extension */ static hasExtension(path: string): boolean; } //# sourceMappingURL=pathparser.d.ts.map