(range: string, version: string)
| 55 | } |
| 56 | |
| 57 | export function isVersionSatisfies(range: string, version: string): boolean { |
| 58 | // Some distributions (e.g. JetBrains Runtime) publish 4-segment versions |
| 59 | // like '17.0.8.1+1080.1' that semver rejects. If the candidate version |
| 60 | // isn't valid semver, it can't match — bail out rather than letting |
| 61 | // compareBuild / satisfies throw. |
| 62 | if (!semver.valid(version)) { |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | if (semver.valid(range)) { |
| 67 | // if full version with build digit is provided as a range (such as '1.2.3+4') |
| 68 | // we should check for exact equal via compareBuild |
| 69 | // since semver.satisfies doesn't handle 4th digit |
| 70 | const semRange = semver.parse(range); |
| 71 | if (semRange && semRange.build?.length > 0) { |
| 72 | return semver.compareBuild(range, version) === 0; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | return semver.satisfies(version, range); |
| 77 | } |
| 78 | |
| 79 | export function getToolcachePath( |
| 80 | toolName: string, |
no outgoing calls
no test coverage detected