/** * File system utility class for path operations and file discovery. */ export default class FileSystem { static fdTypes: readonly string[]; static upperFdTypes: readonly string[]; static fdType: any; /** * Fix slashes in a path * * @static * @param {string} pathName - The path to fix * @returns {string} The fixed path */ static fixSlashes(pathName: string): string; /** * Convert a path to a URI * * @static * @param {string} pathName - The path to convert * @returns {string} The URI */ static pathToUrl(pathName: string): string; /** * Convert a file URL to a path. * * @static * @param {string} fileUrl - The file URL to convert (e.g., import.meta.url) * @returns {string} The file path * @example * const currentFile = FileSystem.urlToPath(import.meta.url) */ static urlToPath(fileUrl: string): string; /** * Computes the relative path from one file or directory to another. * * If the target is outside the source (i.e., the relative path starts with * ".."), returns the absolute path to the target instead. * * @static * @param {import("./FileObject.js").default|import("./DirectoryObject.js").default} from - The source file or directory object * @param {import("./FileObject.js").default|import("./DirectoryObject.js").default} to - The target file or directory object * @returns {string} The relative path from `from` to `to`, or the absolute path if not reachable */ static relativeOrAbsolute(from: import("./FileObject.js").default | import("./DirectoryObject.js").default, to: import("./FileObject.js").default | import("./DirectoryObject.js").default): string; /** * Computes the relative path from one file or directory to another. * * If the target is outside the source (i.e., the relative path starts with * ".."), returns the absolute path to the target instead. * * @static * @param {string} from - The source file or directory object * @param {string} to - The target file or directory object * @returns {string} The relative path from `from` to `to`, or the absolute path if not reachable */ static relativeOrAbsolutePath(from: string, to: string): string; /** * Merge two paths by finding overlapping segments and combining them * efficiently * * @static * @param {string} path1 - The first path * @param {string} path2 - The second path to merge with the first * @param {string} [sep] - The path separator to use (defaults to system separator) * @returns {string} The merged path */ static mergeOverlappingPaths(path1: string, path2: string, sep?: string): string; /** * Resolve a path relative to another path using various strategies * Handles absolute paths, relative navigation, and overlap-based merging * * @static * @param {string} fromPath - The base path to resolve from * @param {string} toPath - The target path to resolve * @returns {string} The resolved path */ static resolvePath(fromPath: string, toPath: string): string; /** * Check if a candidate path is contained within a container path. * * @static * @param {string} container - The container path to check against * @param {string} candidate - The candidate path that might be contained * @returns {boolean} True if candidate is within container, false otherwise * @throws {Sass} If container is not a non-empty string * @throws {Sass} If candidate is not a non-empty string * @example * FS.pathContains("/home/user", "/home/user/docs") // true * FS.pathContains("/home/user", "/home/other") // false */ static pathContains(container: string, candidate: string): boolean; /** * Convert an absolute path to a relative path by finding overlapping segments. * Returns the relative portion of the 'to' path after the last occurrence * of the final segment from the 'from' path. * * @static * @param {string} from - The base path to calculate relative from * @param {string} to - The target path to make relative * @param {string} [sep=path.sep] - The path separator to use (defaults to system separator) * @returns {string|null} The relative path, empty string if paths are identical, or null if no overlap found * @example * FS.toLocalRelativePath("/projects/toolkit", "/projects/toolkit/src") // "src" * FS.toLocalRelativePath("/home/user", "/home/user") // "" * FS.toLocalRelativePath("/projects/app", "/other/path") // null */ static toLocalRelativePath(from: string, to: string, sep?: string): string | null; /** * Computes the relative path from one path to another using Node's path.relative. * * Unlike toLocalRelativePath which uses overlap detection, this method uses * standard relative path calculation and may return paths with ".." segments. * * @static * @param {string} from - The base path to calculate relative from * @param {string} to - The target path to make relative * @returns {string} The relative path, or empty string if paths are identical * @example * FS.toRelativePath("/home/user", "/home/user/docs") // "docs" * FS.toRelativePath("/home/user", "/home/user") // "" * FS.toRelativePath("/home/user", "/home/other") // "../other" */ static toRelativePath(from: string, to: string): string; /** * Find where a path's final segment appears in another path, returning the * portion of 'from' up to that overlap point. * * Looks for the last segment of `from` within `to`. If found, returns `from` * sliced to the index where that segment appears in `to`. * * @static * @param {string} from - The source path whose final segment to search for * @param {string} to - The target path to search within * @param {string} [sep=path.sep] - The path separator to use (defaults to system separator) * @returns {string|null} The sliced portion of from, the original path if identical, or null if no overlap * @throws {Sass} If from is not a non-empty string * @throws {Sass} If to is not a non-empty string * @example * FS.getCommonRootPath("/projects/toolkit", "/projects/toolkit/src") // "/projects/toolkit" * FS.getCommonRootPath("/home/user", "/home/user") // "/home/user" * FS.getCommonRootPath("/projects/app", "/other/path") // null (no overlap) */ static getCommonRootPath(from: string, to: string, sep?: string): string | null; /** * @typedef {object} PathParts * @property {string} base - The file name with extension * @property {string} dir - The directory path * @property {string} ext - The file extension (including dot) * @property {string} root - The root of the path * @property {string} name - The file name without extension */ /** * Deconstruct a file or directory name into parts. * * @static * @param {string} pathName - The file/directory name to deconstruct * @returns {PathParts} The filename parts * @throws {Sass} If not a string of more than 1 character */ static pathParts(pathName: string): { /** * - The file name with extension */ base: string; /** * - The directory path */ dir: string; /** * - The file extension (including dot) */ ext: string; /** * - The root of the path */ root: string; /** * - The file name without extension */ name: string; }; /** * Returns the current working directory as a string. * * @returns {string} The current working directory */ static get cwd(): string; /** * Compute the relative path from another file or directory to this instance. * * If the target is outside the source (i.e., the relative path starts with ".."), * returns the absolute path to this instance instead. * * @param {import("./FileObject.js").default|import("./DirectoryObject.js").default} fileOrDirectoryObject - The source file or directory object * @returns {string} The relative path from the source to this instance, or the absolute path if not reachable * @throws {Sass} If the parameter is not a FileObject or DirectoryObject */ relativeTo(fileOrDirectoryObject: import("./FileObject.js").default | import("./DirectoryObject.js").default): string; /** * Watch this file or directory for changes. * * @param {object} [options] - Watch options * @param {Function} [options.onChange] - Callback invoked on change * @param {number} [options.debounceMs] - Debounce interval in milliseconds * @param {boolean} [options.persistent] - Keep the process alive while watching * @returns {Promise} */ watch(options?: { onChange?: Function; debounceMs?: number; persistent?: boolean; }): Promise; /** * Stop watching this file or directory for changes. */ stopWatching(): void; #private; } //# sourceMappingURL=FileSystem.d.ts.map