(parent: string, directory: string)
| 51 | |
| 52 | // Explicitly export for testing purposes - not part of the public API |
| 53 | export function check_path(parent: string, directory: string) { |
| 54 | // https://stackoverflow.com/a/45242825/15675011 |
| 55 | const relative = path.relative(parent, directory); |
| 56 | if (relative && !relative.startsWith('..') && !path.isAbsolute(relative)) { |
| 57 | // Normalize separators to forward slashes for consistent behavior across platforms |
| 58 | return normalizePath(relative); |
| 59 | } |
| 60 | return false; |
| 61 | } |
| 62 | |
| 63 | // Explicitly export for testing purposes - not part of the public API |
| 64 | export function get_diagnostic() { |
no test coverage detected