Skip to content

Commit 5a5b321

Browse files
committed
[extensions] Add new library: Bun, Dart, Deno, hackney, Node.js, rest-client, undici
1 parent e9f78ce commit 5a5b321

File tree

3 files changed

+94
-15
lines changed

3 files changed

+94
-15
lines changed

src/enums/ua-parser-enums.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,26 +708,33 @@ const Extension = Object.freeze({
708708
AIOHTTP: 'aiohttp',
709709
APACHE_HTTPCLIENT: 'Apache-HttpClient',
710710
AXIOS: 'axios',
711+
BUN: 'Bun',
712+
DART: 'Dart',
713+
DENO: 'Deno',
711714
GO_HTTP_CLIENT: 'go-http-client',
712715
GOT: 'got',
713716
GUZZLEHTTP: 'GuzzleHttp',
717+
HACKNEY: 'hackney',
714718
JAVA: 'Java',
715719
JAVA_HTTPCLIENT: 'Java-http-client',
716720
JSDOM: 'jsdom',
717721
LIBWWW_PERL: 'libwww-perl',
718722
LUA_RESTY_HTTP: 'lua-resty-http',
719723
NEEDLE: 'Needle',
720724
NUTCH: 'Nutch',
721-
OKHTTP: 'OkHttp',
722725
NODE_FETCH: 'node-fetch',
726+
NODE_JS: 'Node.js',
723727
NODE_SUPERAGENT: 'node-superagent',
728+
OKHTTP: 'OkHttp',
724729
PHP_SOAP: 'PHP-SOAP',
725730
POSTMAN_RUNTIME: 'PostmanRuntime',
726731
PYTHON_HTTPX: 'python-httpx',
727732
PYTHON_URLLIB: 'python-urllib',
728733
PYTHON_URLLIB3: 'python-urllib3',
729734
PYTHON_REQUESTS: 'python-requests',
730-
SCRAPY: 'Scrapy'
735+
REST_CLIENT: 'rest-client',
736+
SCRAPY: 'Scrapy',
737+
UNDICI: 'undici'
731738
}
732739
},
733740
DeviceVendor: {

src/extensions/ua-parser-extensions.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,15 @@ const MediaPlayers = Object.freeze({
389389

390390
const Libraries = Object.freeze({
391391
browser : [
392-
// 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
393392
[
394-
/^(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,
393+
// 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
394+
/^(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,
395395
/(adobeair|aiohttp|jsdom)\/([\w\.]+)/i,
396396
/(nutch)-([\w\.-]+)(\(|$)/i,
397397
/\((java)\/([\w\.]+)/i
398-
], [NAME, VERSION, [TYPE, LIBRARY]]
398+
], [NAME, VERSION, [TYPE, LIBRARY]], [
399+
/(node-fetch|undici)/i
400+
], [NAME, [TYPE, LIBRARY]]
399401
]
400402
});
401403

test/data/ua/extension/library.json

Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,36 @@
3939
"type" : "library"
4040
}
4141
},
42+
{
43+
"desc" : "Bun",
44+
"ua" : "Bun/1.0.6",
45+
"expect" :
46+
{
47+
"name" : "Bun",
48+
"version" : "1.0.6",
49+
"type" : "library"
50+
}
51+
},
52+
{
53+
"desc" : "Dart",
54+
"ua" : "Dart/3.5 (dart:io)",
55+
"expect" :
56+
{
57+
"name" : "Dart",
58+
"version" : "3.5",
59+
"type" : "library"
60+
}
61+
},
62+
{
63+
"desc" : "Deno",
64+
"ua" : "Deno/2.1.7",
65+
"expect" :
66+
{
67+
"name" : "Deno",
68+
"version" : "2.1.7",
69+
"type" : "library"
70+
}
71+
},
4272
{
4373
"desc" : "go-http-client",
4474
"ua" : "go-http-client/1.1",
@@ -59,6 +89,16 @@
5989
"type" : "library"
6090
}
6191
},
92+
{
93+
"desc" : "hackney",
94+
"ua" : "hackney/1.20.1",
95+
"expect" :
96+
{
97+
"name" : "hackney",
98+
"version" : "1.20.1",
99+
"type" : "library"
100+
}
101+
},
62102
{
63103
"desc" : "GuzzleHttp",
64104
"ua" : "GuzzleHttp/6.5.5 curl/7.70.0 PHP/7.4.22",
@@ -129,6 +169,26 @@
129169
"type" : "library"
130170
}
131171
},
172+
{
173+
"desc" : "Node.js",
174+
"ua" : "Node.js/22",
175+
"expect" :
176+
{
177+
"name" : "Node.js",
178+
"version" : "22",
179+
"type" : "library"
180+
}
181+
},
182+
{
183+
"desc" : "node-fetch",
184+
"ua" : "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
185+
"expect" :
186+
{
187+
"name" : "node-fetch",
188+
"version" : "1.0",
189+
"type" : "library"
190+
}
191+
},
132192
{
133193
"desc" : "Nutch",
134194
"ua" : "AliyunSecBot/Nutch-1.21-SNAPSHOT",
@@ -149,16 +209,6 @@
149209
"type" : "library"
150210
}
151211
},
152-
{
153-
"desc" : "node-fetch",
154-
"ua" : "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
155-
"expect" :
156-
{
157-
"name" : "node-fetch",
158-
"version" : "1.0",
159-
"type" : "library"
160-
}
161-
},
162212
{
163213
"desc" : "PHP-SOAP",
164214
"ua" : "PHP-SOAP/7.4.33",
@@ -219,6 +269,16 @@
219269
"type" : "library"
220270
}
221271
},
272+
{
273+
"desc" : "rest-client",
274+
"ua" : "rest-client/2.1.0 (linux-gnu x86_64) ruby/2.7.2p137",
275+
"expect" :
276+
{
277+
"name" : "rest-client",
278+
"version" : "2.1.0",
279+
"type" : "library"
280+
}
281+
},
222282
{
223283
"desc" : "Scrapy",
224284
"ua" : "Scrapy/1.5.0 (+https://scrapy.org)",
@@ -238,5 +298,15 @@
238298
"version" : "5.0.2",
239299
"type" : "library"
240300
}
301+
},
302+
{
303+
"desc" : "undici",
304+
"ua" : "undici",
305+
"expect" :
306+
{
307+
"name" : "undici",
308+
"version" : "undefined",
309+
"type" : "library"
310+
}
241311
}
242312
]

0 commit comments

Comments
 (0)