fix: prevent matching package names starting with 'uv' in dependency parsing

The previous regex would match any package starting with 'uv' (like 'uvicorn', 'uvloop', etc.) and incorrectly parse them as uv version specifications. This fix ensures we only match the actual 'uv' package by requiring a version specifier character immediately after 'uv'.

Fixes the issue where 'uvicorn==0.35.0' was being parsed as 'icorn==0.35.0'.
This commit is contained in:
phpmypython 2025-07-17 16:44:16 -04:00
parent 05273c154d
commit 5a9b0f020b
No known key found for this signature in database
GPG key ID: 6D09313BDCAD85F4

View file

@ -15,8 +15,8 @@ function getUvVersionFromAllDependencies(
allDependencies: string[],
): string | undefined {
return allDependencies
.find((dep: string) => dep.startsWith("uv"))
?.match(/^uv([^A-Z0-9._-]+.*)$/)?.[1]
.find((dep: string) => dep.match(/^uv[=<>~!]/))
?.match(/^uv([=<>~!]+.*)$/)?.[1]
.trim();
}