/** * @file Path predicates — `is*` checks for path shape and kind. Split out of * `paths/normalize.ts` for file-size hygiene. Pure boolean predicates over * paths and character codes. * * - `isAbsolute`, `isRelative` — root-anchoring shape * - `isPath` — file-path vs package-spec vs URL discriminator * - `isNodeModules`, `isUnixPath` — content-pattern checks * - `isPathSeparator`, `isWindowsDeviceRoot` — char-code primitives * - `isPathWithinRoot` — realpath containment check */ /** * Check if a path is absolute. * * Handles both POSIX (`/...`) and Windows (drive-letter, UNC, device) absolute * path shapes. * * @example * ;```typescript * isAbsolute('/home/user') // true * isAbsolute('C:\\Windows') // true on Windows * isAbsolute('../relative') // false * ``` * * @param {string | Buffer | URL} pathLike - The path to check. * * @returns {boolean} `true` if absolute, `false` otherwise */ export declare function isAbsolute(pathLike: string | Buffer | URL): boolean; /** * Check if a path contains a `node_modules` directory segment. * * Matches `node_modules` only as a complete path segment. * * @example * ;```typescript * isNodeModules('/project/node_modules/package') // true * isNodeModules('/src/my_node_modules_backup') // false * ``` * * @param {string | Buffer | URL} pathLike - The path to check. * * @returns {boolean} `true` if the path contains `node_modules` */ export declare function isNodeModules(pathLike: string | Buffer | URL): boolean; /** * Check if a value is a valid absolute or relative file path. * * Distinguishes between file paths and other string formats like package names, * URLs, or bare module specifiers. * * @example * ;```typescript * isPath('/absolute/path') // true * isPath('./relative/path') // true * isPath('@scope/name/subpath') // true * isPath('lodash') // false * isPath('http://example.com') // false * ``` * * @param {string | Buffer | URL} pathLike - The value to check. * * @returns {boolean} `true` if the value is a valid file path */ export declare function isPath(pathLike: string | Buffer | URL): boolean; /** * Check if a character code is a path separator (`/` or `\`). * * @example * ;```typescript * isPathSeparator(47) // true — '/' * isPathSeparator(92) // true — '\' * isPathSeparator(65) // false — 'A' * ``` * * @param {number} code - The character code to check. * * @returns {boolean} `true` if separator */ export declare function isPathSeparator(code: number): boolean; /** * Report whether a path sits at or under a root. Both sides must already be * realpath'd. * * @example * ;```typescript * isPathWithinRoot('/repo/bin/git', '/repo') // true * isPathWithinRoot('/usr/bin/git', '/repo') // false * ``` */ export declare function isPathWithinRoot(candidate: string, root: string): boolean; /** * Check if a path is relative (i.e., not absolute). * * Empty strings are treated as relative. * * @example * ;```typescript * isRelative('./src/index.js') // true * isRelative('src/file.js') // true * isRelative('/home/user') // false * ``` * * @param {string | Buffer | URL} pathLike - The path to check. * * @returns {boolean} `true` if the path is relative */ export declare function isRelative(pathLike: string | Buffer | URL): boolean; /** * Check if a value is wrapped in path separators on BOTH ends — the * `/wrapped/` sigil some list formats use to mark a substring (not exact) * entry. Either separator direction counts on either end, so a stray * backslash-wrapped entry is still read as the sigil rather than silently * treated as an exact path. * * @example * ;```typescript * isSeparatorWrapped('/rendering-chromium-to-png/') // true * isSeparatorWrapped('\\rendering-chromium-to-png\\') // true * isSeparatorWrapped('scripts/fleet/acquire.mts') // false * isSeparatorWrapped('//') // false * ``` * * @param {string | Buffer | URL} pathLike - The value to check. * * @returns {boolean} `true` if both ends are path separators with content * between. */ export declare function isSeparatorWrapped(pathLike: string | Buffer | URL): boolean; /** * Check if a path uses MSYS/Git Bash Unix-style drive letter notation. * * Detects paths in the format `/c/...` where a single letter after the leading * slash represents a Windows drive letter. * * @example * ;```typescript * isUnixPath('/c/tools/bin') // true * isUnixPath('/tmp/build') // false * isUnixPath('C:/Windows') // false * ``` * * @param {string | Buffer | URL} pathLike - The path to check. * * @returns {boolean} `true` if the path uses MSYS drive letter notation */ export declare function isUnixPath(pathLike: string | Buffer | URL): boolean; /** * Check if a character code is a Windows device root letter (A-Z / a-z). * * @example * ;```typescript * isWindowsDeviceRoot(67) // true — 'C' * isWindowsDeviceRoot(99) // true — 'c' * isWindowsDeviceRoot(58) // false — ':' * ``` * * @param {number} code - The character code to check. * * @returns {boolean} `true` if valid drive-letter code */ export declare function isWindowsDeviceRoot(code: number): boolean; /** * The forward-slash substring form of a separator-wrapped entry, or * undefined when the value is not wrapped. The inner segment's backslashes * become forward slashes so the needle matches against normalized paths. * * @example * ;```typescript * separatorWrappedSubstring('/rendering-chromium-to-png/') // '/rendering-chromium-to-png/' * separatorWrappedSubstring('\\rendering-chromium-to-png\\') // '/rendering-chromium-to-png/' * separatorWrappedSubstring('scripts/fleet/acquire.mts') // undefined * ``` * * @param {string | Buffer | URL} pathLike - The value to convert. * * @returns {string | undefined} The `/inner/` substring form, or undefined */ export declare function separatorWrappedSubstring(pathLike: string | Buffer | URL): string | undefined;