From 253f5b8f8141884c7e06676859ff0683f772363f Mon Sep 17 00:00:00 2001 From: "Adam G-H (phenaproxima)" Date: Sun, 4 Oct 2026 10:17:46 -0400 Subject: [PATCH 1/2] feat: add Bun to the default software registry Bun's release tags are prefixed (e.g. `bun-v1.4.2`), so they never parsed as versions and every Bun release was silently skipped. Allow an optional lowercase word followed by `-` or `_` before the version number in Version::fromVersionString(), which lets such tags parse. Text stuck directly to the digits (`version1.2.3`) stays invalid, matching the existing Composer-style contract. Add Bun to the default registry with an asset pattern that excludes the `-profile` builds and the SHASUMS256 checksum files. --- resources/software.json | 18 ++++++++++++++++++ src/Module/Version/Version.php | 4 ++-- tests/Unit/Module/Version/VersionTest.php | 11 +++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/resources/software.json b/resources/software.json index 1ddd6958..720c670f 100644 --- a/resources/software.json +++ b/resources/software.json @@ -259,6 +259,24 @@ "name": "rapira", "version-command": "--version" } + }, + { + "name": "Bun", + "alias": "bun", + "description": "Incredibly fast JavaScript runtime, bundler, test runner, and package manager - all in one.", + "homepage": "https://bun.com", + "repositories": [ + { + "type": "github", + "uri": "oven-sh/bun", + "asset-pattern": "/^bun-(?!.*-profile\\.zip$).*/" + } + ], + "binary": { + "name": "bun", + "pattern": "/^bun(?:x)?(?:\\.exe)?$/", + "version-command": "--version" + } } ] } diff --git a/src/Module/Version/Version.php b/src/Module/Version/Version.php index f30c9dc9..7e8d1ab8 100644 --- a/src/Module/Version/Version.php +++ b/src/Module/Version/Version.php @@ -13,8 +13,8 @@ */ class Version implements \Stringable { - protected const VERSION_SEMVER_PATTERN = 'v?(\d+\.\d+\.\d+(?:\+\d+)?)([-+][\w.-]+)?'; - protected const VERSION_FALLBACK_PATTERN = 'v?(\d+(?:\.\d+(?:\.\d+(?:\+\d+)?)?)?)([-+.][\w.-]+)?'; + protected const VERSION_SEMVER_PATTERN = '(?:[a-z]+[-_])?v?(\d+\.\d+\.\d+(?:\+\d+)?)([-+][\w.-]+)?'; + protected const VERSION_FALLBACK_PATTERN = '(?:[a-z]+[-_])?v?(\d+(?:\.\d+(?:\.\d+(?:\+\d+)?)?)?)([-+.][\w.-]+)?'; protected const VERSION_HASH_SUFFIX_PATTERN = '(?:#([a-f0-9]{6,40}))?'; /** diff --git a/tests/Unit/Module/Version/VersionTest.php b/tests/Unit/Module/Version/VersionTest.php index 23f50c57..60e0c4f4 100644 --- a/tests/Unit/Module/Version/VersionTest.php +++ b/tests/Unit/Module/Version/VersionTest.php @@ -49,6 +49,12 @@ public static function provideValidVersionStrings(): \Generator // Case insensitive stability yield 'version with uppercase stability' => ['1.2.3-BETA', '1.2.3-BETA', '1.2.3', null, Stability::Beta]; yield 'version with mixed case stability' => ['1.2.3-Alpha', '1.2.3-Alpha', '1.2.3', null, Stability::Alpha]; + + // Versions with a lowercase word prefix, as used in release tags like `bun-v1.4.2` + yield 'prefixed tag with v' => ['bun-v1.4.2', 'bun-v1.4.2', '1.4.2', null, Stability::Stable]; + yield 'prefixed tag without v' => ['bun-1.4.2', 'bun-1.4.2', '1.4.2', null, Stability::Stable]; + yield 'prefixed tag with underscore separator' => ['tool_1.4.2', 'tool_1.4.2', '1.4.2', null, Stability::Stable]; + yield 'prefixed tag with stability suffix' => ['bun-v1.4.2-canary.1', 'bun-v1.4.2-canary.1', '1.4.2', 'canary.1', Stability::Preview]; } /** @@ -65,6 +71,9 @@ public static function provideInvalidVersionStrings(): \Generator yield 'dev-feature+issue-1' => ['dev-feature+issue-1']; yield '1.0.0-alpha11+cs-1.1.0' => ['1.0.0-alpha11+cs-1.1.0']; yield '1.0.0-beta#comment-part' => ['1.0.0-beta#comment-part']; + + // Prefixes that must still be rejected: text stuck to the digits without a separator + yield 'text directly before digits' => ['version1.2.3']; } /** @@ -127,6 +136,8 @@ public static function provideVersionsAndExpectedStability(): \Generator // Real cases yield 'real case 2' => ['v1.3.1-nexus-cancellation.0', Stability::Preview, 'Temporal cancellation version']; yield 'real case 3' => ['v1.3.0', Stability::Stable, 'Stable version']; + yield 'prefixed tag' => ['bun-v1.4.2', Stability::Stable, 'Bun release tag']; + yield 'prefixed tag with canary suffix' => ['bun-v1.4.2-canary.1', Stability::Preview, 'Bun canary tag']; } /** From 4430dacac0395a925624921b49ac8d5df3c3ef4c Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 5 Oct 2026 07:16:58 -0400 Subject: [PATCH 2/2] Fix whitespace in software.json Signed-off-by: Adam --- resources/software.json | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/software.json b/resources/software.json index 885adbcf..cc501524 100644 --- a/resources/software.json +++ b/resources/software.json @@ -294,6 +294,5 @@ "pattern": "/^bun(?:x)?(?:\\.exe)?$/", } } - ] }