From 5a5b3213477c6618bca2b633e1cc4f5c2cff7e6e Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sun, 9 Nov 2025 15:33:15 +0700 Subject: [PATCH] [extensions] Add new library: Bun, Dart, Deno, hackney, Node.js, rest-client, undici --- src/enums/ua-parser-enums.js | 11 +++- src/extensions/ua-parser-extensions.js | 8 ++- test/data/ua/extension/library.json | 90 +++++++++++++++++++++++--- 3 files changed, 94 insertions(+), 15 deletions(-) diff --git a/src/enums/ua-parser-enums.js b/src/enums/ua-parser-enums.js index d6ef646..d3c184b 100644 --- a/src/enums/ua-parser-enums.js +++ b/src/enums/ua-parser-enums.js @@ -708,9 +708,13 @@ const Extension = Object.freeze({ AIOHTTP: 'aiohttp', APACHE_HTTPCLIENT: 'Apache-HttpClient', AXIOS: 'axios', + BUN: 'Bun', + DART: 'Dart', + DENO: 'Deno', GO_HTTP_CLIENT: 'go-http-client', GOT: 'got', GUZZLEHTTP: 'GuzzleHttp', + HACKNEY: 'hackney', JAVA: 'Java', JAVA_HTTPCLIENT: 'Java-http-client', JSDOM: 'jsdom', @@ -718,16 +722,19 @@ const Extension = Object.freeze({ LUA_RESTY_HTTP: 'lua-resty-http', NEEDLE: 'Needle', NUTCH: 'Nutch', - OKHTTP: 'OkHttp', NODE_FETCH: 'node-fetch', + NODE_JS: 'Node.js', NODE_SUPERAGENT: 'node-superagent', + OKHTTP: 'OkHttp', PHP_SOAP: 'PHP-SOAP', POSTMAN_RUNTIME: 'PostmanRuntime', PYTHON_HTTPX: 'python-httpx', PYTHON_URLLIB: 'python-urllib', PYTHON_URLLIB3: 'python-urllib3', PYTHON_REQUESTS: 'python-requests', - SCRAPY: 'Scrapy' + REST_CLIENT: 'rest-client', + SCRAPY: 'Scrapy', + UNDICI: 'undici' } }, DeviceVendor: { diff --git a/src/extensions/ua-parser-extensions.js b/src/extensions/ua-parser-extensions.js index 736c091..3c9d9f4 100644 --- a/src/extensions/ua-parser-extensions.js +++ b/src/extensions/ua-parser-extensions.js @@ -389,13 +389,15 @@ const MediaPlayers = Object.freeze({ const Libraries = Object.freeze({ browser : [ - // Apache-HttpClient/Axios/go-http-client/got/GuzzleHttp/Java[-HttpClient]/jsdom/libwww-perl/lua-resty-http/Needle/node-fetch/OkHttp/PHP-SOAP/PostmanRuntime/python-urllib/python-requests/Scrapy/superagent [ - /^(apache-httpclient|axios|(?:go|java)-http-client|got|guzzlehttp|java|libwww-perl|lua-resty-http|needle|node-(?:fetch|superagent)|okhttp|php-soap|postmanruntime|python-(?:httpx|urllib[23]?|requests)|scrapy)\/([\w\.]+)/i, + // Apache-HttpClient/Axios/Bun/Dart/go-http-client/got/GuzzleHttp/hackney/Java[-HttpClient]/jsdom/libwww-perl/lua-resty-http/Needle/Node.js/node-fetch/OkHttp/PHP-SOAP/PostmanRuntime/python-urllib/python-requests/rest-client/Scrapy/superagent + /^(apache-httpclient|axios|bun|dart|deno|(?:go|java)-http-client|got|guzzlehttp|hackney|java|libwww-perl|lua-resty-http|needle|node(?:\.js|-fetch|-superagent)|okhttp|php-soap|postmanruntime|python-(?:httpx|urllib[23]?|requests)|rest-client|scrapy)\/([\w\.]+)/i, /(adobeair|aiohttp|jsdom)\/([\w\.]+)/i, /(nutch)-([\w\.-]+)(\(|$)/i, /\((java)\/([\w\.]+)/i - ], [NAME, VERSION, [TYPE, LIBRARY]] + ], [NAME, VERSION, [TYPE, LIBRARY]], [ + /(node-fetch|undici)/i + ], [NAME, [TYPE, LIBRARY]] ] }); diff --git a/test/data/ua/extension/library.json b/test/data/ua/extension/library.json index 17435a2..da29481 100644 --- a/test/data/ua/extension/library.json +++ b/test/data/ua/extension/library.json @@ -39,6 +39,36 @@ "type" : "library" } }, + { + "desc" : "Bun", + "ua" : "Bun/1.0.6", + "expect" : + { + "name" : "Bun", + "version" : "1.0.6", + "type" : "library" + } + }, + { + "desc" : "Dart", + "ua" : "Dart/3.5 (dart:io)", + "expect" : + { + "name" : "Dart", + "version" : "3.5", + "type" : "library" + } + }, + { + "desc" : "Deno", + "ua" : "Deno/2.1.7", + "expect" : + { + "name" : "Deno", + "version" : "2.1.7", + "type" : "library" + } + }, { "desc" : "go-http-client", "ua" : "go-http-client/1.1", @@ -59,6 +89,16 @@ "type" : "library" } }, + { + "desc" : "hackney", + "ua" : "hackney/1.20.1", + "expect" : + { + "name" : "hackney", + "version" : "1.20.1", + "type" : "library" + } + }, { "desc" : "GuzzleHttp", "ua" : "GuzzleHttp/6.5.5 curl/7.70.0 PHP/7.4.22", @@ -129,6 +169,26 @@ "type" : "library" } }, + { + "desc" : "Node.js", + "ua" : "Node.js/22", + "expect" : + { + "name" : "Node.js", + "version" : "22", + "type" : "library" + } + }, + { + "desc" : "node-fetch", + "ua" : "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)", + "expect" : + { + "name" : "node-fetch", + "version" : "1.0", + "type" : "library" + } + }, { "desc" : "Nutch", "ua" : "AliyunSecBot/Nutch-1.21-SNAPSHOT", @@ -149,16 +209,6 @@ "type" : "library" } }, - { - "desc" : "node-fetch", - "ua" : "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)", - "expect" : - { - "name" : "node-fetch", - "version" : "1.0", - "type" : "library" - } - }, { "desc" : "PHP-SOAP", "ua" : "PHP-SOAP/7.4.33", @@ -219,6 +269,16 @@ "type" : "library" } }, + { + "desc" : "rest-client", + "ua" : "rest-client/2.1.0 (linux-gnu x86_64) ruby/2.7.2p137", + "expect" : + { + "name" : "rest-client", + "version" : "2.1.0", + "type" : "library" + } + }, { "desc" : "Scrapy", "ua" : "Scrapy/1.5.0 (+https://scrapy.org)", @@ -238,5 +298,15 @@ "version" : "5.0.2", "type" : "library" } + }, + { + "desc" : "undici", + "ua" : "undici", + "expect" : + { + "name" : "undici", + "version" : "undefined", + "type" : "library" + } } ]