(spec: string)
| 20 | } |
| 21 | |
| 22 | export function parsePluginSpecifier(spec: string) { |
| 23 | const hit = parse(spec) |
| 24 | if (hit?.type === "alias" && !hit.name) { |
| 25 | const sub = (hit as npa.AliasResult).subSpec |
| 26 | if (sub?.name) { |
| 27 | const version = !sub.rawSpec || sub.rawSpec === "*" ? "latest" : sub.rawSpec |
| 28 | return { pkg: sub.name, version } |
| 29 | } |
| 30 | } |
| 31 | if (!hit?.name) return { pkg: spec, version: "" } |
| 32 | if (hit.raw === hit.name) return { pkg: hit.name, version: "latest" } |
| 33 | return { pkg: hit.name, version: hit.rawSpec } |
| 34 | } |
| 35 | |
| 36 | export type PluginSource = "file" | "npm" |
| 37 | export type PluginKind = "server" | "tui" |
no test coverage detected