import type { Flavored } from './types.js'; /** * An absolute path on the filesystem. Named "id" to be consistent with Rollup. */ export type PathId = Flavored; /** * Basic information about a filesystem path. */ export interface PathInfo { id: PathId; is_directory: boolean; } /** * A resolved path with both the original path string and its absolute id. */ export interface ResolvedPath extends PathInfo { path: string; } /** * A filter function for paths, can distinguish between files and directories. */ export type PathFilter = (path: string, is_directory: boolean) => boolean; /** * A filter function for file paths only. */ export type FileFilter = (path: string) => boolean; /** * Converts a URL to a file path string, or returns the string as-is. */ export declare const to_file_path: (path_or_url: string | URL) => string; /** * @example * ```ts * parse_path_parts('./foo/bar/baz.ts') // => ['foo', 'foo/bar', 'foo/bar/baz.ts'] * ``` */ export declare const parse_path_parts: (path: string) => Array; /** * Gets the individual parts of a path, ignoring dots and separators. * @example * ```ts * parse_path_segments('/foo/bar/baz.ts') // => ['foo', 'bar', 'baz.ts'] * ``` */ export declare const parse_path_segments: (path: string) => Array; /** * A piece of a parsed path, either a path segment or separator. */ export type PathPiece = { type: 'piece'; path: PathId; name: string; } | { type: 'separator'; path: PathId; }; /** * Treats all paths as absolute, so the first piece is always a `'/'` with type `'separator'`. * @todo maybe rethink this API, it's a bit weird, but fits the usage in `ui/Breadcrumbs.svelte` */ export declare const parse_path_pieces: (raw_path: string) => Array; /** * Checks if a filename matches any exclusion pattern. * * Returns `false` when `filename` is `undefined`, empty string, or `exclude` is empty. * String patterns use substring matching. RegExp patterns use `.test()`. * * @param filename - the file path to check, or `undefined` for virtual files * @param exclude - array of string or RegExp exclusion patterns * @returns `true` if the file should be excluded from processing */ export declare const should_exclude_path: (filename: string | undefined, exclude: Array) => boolean; /** * Converts a string into a URL-compatible slug. * @param map_special_characters - if `true`, characters like `ñ` are converted to their ASCII equivalents, runs around 5x faster when disabled */ export declare const slugify: (str: string, map_special_characters?: boolean) => string; //# sourceMappingURL=path.d.ts.map