(source: string, target: string)
| 42 | * hashes (e.g., #foo) as non-local paths and likewise returns null. |
| 43 | */ |
| 44 | export function resolveLocalPath(source: string, target: string): string | null { |
| 45 | if (/^\w+:/.test(target)) return null; // URL |
| 46 | if (target.startsWith("#")) return null; // anchor tag |
| 47 | const path = resolvePath(source, target); |
| 48 | if (path.startsWith("../")) return null; // goes above root |
| 49 | return path; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Returns true if the specified specifier refers to a local path, as opposed to |
no test coverage detected