21 lines
530 B
TypeScript
21 lines
530 B
TypeScript
/**
|
|
* Returns true if the value is NOT a package source (npm:, git:, etc.)
|
|
* or a URL protocol. Bare names and relative paths without ./ prefix
|
|
* are considered local.
|
|
*/
|
|
export function isLocalPath(value: string): boolean {
|
|
const trimmed = value.trim();
|
|
// Known non-local prefixes
|
|
if (
|
|
trimmed.startsWith("npm:") ||
|
|
trimmed.startsWith("git:") ||
|
|
trimmed.startsWith("github:") ||
|
|
trimmed.startsWith("http:") ||
|
|
trimmed.startsWith("https:") ||
|
|
trimmed.startsWith("ssh:")
|
|
) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|