From 46f47bba36a12d4569fca29e45b89c44c0cc0fd0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 13:31:33 +0000 Subject: [PATCH] feat: support arbitrary sub-file paths for bundlejs badges Update the route patterns in `pages/api/bundlejs.ts` to use greedy matching (:name+) for the package name. This allows the badge service to correctly handle packages with sub-file paths, such as `@noble/hashes/sha3.js`. Added a new example to demonstrate this capability. Verified with manual testing and existing test suite. Ref: https://github.com/badgen/badgen.net/issues/734 Co-authored-by: amio <215282+amio@users.noreply.github.com> --- pages/api/bundlejs.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pages/api/bundlejs.ts b/pages/api/bundlejs.ts index dfa6b313..d44b8bea 100644 --- a/pages/api/bundlejs.ts +++ b/pages/api/bundlejs.ts @@ -9,10 +9,11 @@ export default createBadgenHandler({ '/bundlejs/min/react': 'minified', '/bundlejs/minzip/react': 'minified + gzip', '/bundlejs/minzip/@noble/hashes': '(scoped pkg) minified + gzip', + '/bundlejs/minzip/@noble/hashes/sha3.js': '(scoped pkg) minified + gzip (sub-path)', }, handlers: { - '/bundlejs/:topic/:scope<@.*>/:name': handler, - '/bundlejs/:topic/:name': handler, + '/bundlejs/:topic/:scope<@.*>/:name+': handler, + '/bundlejs/:topic/:name+': handler, } })