Update version to 2.0.0-rc.2

This commit is contained in:
Faisal Salman 2024-11-07 20:58:26 +07:00
parent 0808d1d940
commit a1644b6775
17 changed files with 150 additions and 81 deletions

View File

@ -10,8 +10,6 @@ assignees: ''
**Library version**
Which version of the library that you use, eg: v0.7.35 or v2.0.0-alpha.3
For the issue related with detection result, you can use the demo section in https://uaparser.dev to confirm
**Describe the bug**
A clear and concise description of what the bug is.
@ -23,11 +21,13 @@ Steps to reproduce the behavior:
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
A clear and concise description of what you expected to happen, or what's referred in the docs https://docs.uaparser.dev/
**Screenshots**
If applicable, add screenshots to help explain your problem.
For issues related to detection results, you can send the screenshots of the demo section at https://uaparser.dev/#demo to confirm.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]

View File

@ -1,5 +1,46 @@
# UAParser.js Changelog
## Migrating from v1 to v2
- What's breaking:
- Licensed under AGPLv3 (open-source) or PRO License (commercial)
- Browser detection on mobile device: `"Chrome" => "Mobile Chrome"`, `"Firefox" => "Mobile Firefox"`
- OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"`
- What's new:
- New device type: `xr`, to identify AR/VR devices
- New browser property: `browser.type`, to identify the type of the browser: `crawler`, `cli`, `email`, `fetcher`, `inapp`, `mediaplayer`, `module`
- New methods in result object (all of `get*()` return value):
- Support for client hints: `withClientHints()`
- Support for feature detection: `withFeatureCheck()`
- Utility for easy comparison: `is()`
- Utility to print full-name: `toString()`
- Parse directly from command line using `npx ua-parser-js`
- Extensions can be passed as a list to `UAParser()`
- Support for ES module & TypeScript `import { UAParser } from 'ua-parser-js'`
- Provided Enums submodule `'ua-parser-js/enums'`
- Provided Extensions submodule `'ua-parser-js/extensions'`
- Provided Helpers submodule `'ua-parser-js/helpers'`:
- `getDeviceVendor()` to guess for a device vendor based on its model name
- `isAppleSilicon()` to check if the device has Apple Silicon Mac device properties
- `isBot()` to check if the browser is identified as a bot
- `isChromeFamily()` to check if the browser is Chrome-based / has Blink engine (i.e: New Opera, New Edge, Vivaldi, Brave, Arc, etc.)
- `isElectron()` to check if current window is running inside Electron
- `isFromEU()` to check if current window is from an EU (European Union) country
- `isFrozenUA()` to check if a user-agent string match with the reduced/frozen user-agent pattern
- `isStandalonePWA()` to check if current window is a standalone PWA
--
## Version 2.0.0-rc.2
- Fix incorrect import path in ESM files
- Add new browser: 115, SlimBoat, Slimjet, LibreWolf
- Improve browser detection: 2345, 360, Dragon, Iron, Maxthon
- `ua-parser-js/enums` submodule:
- Add Chromecast OS variants: Android/Fuchsia/Linux/SmartSpeaker
- `ua-parser-js/helpers` submodule:
- Add new method: `isBot()` to check if the browser is identified as a bot
## Version 2.0.0-rc.1
- Fix Python Request mistakenly identified as Meta Quest
@ -68,27 +109,6 @@
- Initial work on new major version
## Version 2.0
- What's breaking:
- Dual-licensed under AGPLv3 or PRO License
- Browser detection on mobile device: `"Chrome" => "Mobile Chrome"`, `"Firefox" => "Mobile Firefox"`
- OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"`
- AR/VR devices moved to new device type: `xr`
- New property in `browser`: `type`
- What's new:
- Some new methods in result object:
- Support for client hints: `withClientHints()`
- Support for feature detection: `withFeatureCheck()`
- Utility for easy comparison: `is()`
- Utility to print full-name: `toString()`
- Parse directly from command line using `npx ua-parser-js`
- Extensions can be passed as a list to `UAParser()`
- Support for ES module `import { UAParser } from 'ua-parser-js'`
- Provided Enums submodule `'ua-parser-js/enums'`
- Provided Extensions submodule `'ua-parser-js/extensions'`
- Provided Helpers submodule `'ua-parser-js/helpers'`
---
## Version 0.7.38 / 1.0.38

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

46
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "ua-parser-js",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ua-parser-js",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"funding": [
{
"type": "opencollective",
@ -23,7 +23,9 @@
],
"license": "AGPL-3.0-or-later",
"dependencies": {
"detect-europe-js": "^0.1.1"
"detect-europe-js": "^0.1.1",
"is-standalone-pwa": "^0.1.0",
"ua-is-frozen": "^0.1.1"
},
"bin": {
"ua-parser-js": "script/cli.js"
@ -2609,6 +2611,25 @@
"node": ">=8"
}
},
"node_modules/is-standalone-pwa": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/is-standalone-pwa/-/is-standalone-pwa-0.1.0.tgz",
"integrity": "sha512-n5SQqXd0/JEkrKYEB7ZUndwuS7NKskZvk6rZZt6kTE1jiPxtPfPvVhXkfteIKpUfcEP07qsja/Wjz9NDjiZ5gg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/faisalman"
},
{
"type": "opencollective",
"url": "https://opencollective.com/ua-parser-js"
},
{
"type": "paypal",
"url": "https://paypal.me/faisalman"
}
]
},
"node_modules/isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
@ -4597,6 +4618,25 @@
"node": "*"
}
},
"node_modules/ua-is-frozen": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/ua-is-frozen/-/ua-is-frozen-0.1.1.tgz",
"integrity": "sha512-TxhyfblPzcDJXRXu/j+73OI6s1jG6PUZBF/8hjTHoAsjZYKl9IhZzLQlnZHFLe5U2mvL1lMOOmcy647KpUq25A==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/faisalman"
},
{
"type": "opencollective",
"url": "https://opencollective.com/ua-parser-js"
},
{
"type": "paypal",
"url": "https://paypal.me/faisalman"
}
]
},
"node_modules/uglify-js": {
"version": "3.12.8",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.8.tgz",

View File

@ -1,7 +1,7 @@
{
"title": "UAParser.js",
"name": "ua-parser-js",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment",
"keywords": [

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////
/* Enums for UAParser.js v2.0.0-rc.1
/* Enums for UAParser.js v2.0.0-rc.2
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <f@faisalman.com>
AGPLv3 License */

View File

@ -3,7 +3,7 @@
// Source: /src/enums/ua-parser-enums.js
///////////////////////////////////////////////
/* Enums for UAParser.js v2.0.0-rc.1
/* Enums for UAParser.js v2.0.0-rc.2
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <f@faisalman.com>
AGPLv3 License */
@ -12,8 +12,9 @@
/*jshint esversion: 6 */
const Browser = Object.freeze({
'2345_EXPLORER': '2345Explorer',
'360': '360 Browser',
'115': '115',
'2345': '2345',
'360': '360',
ALIPAY: 'Alipay',
AMAYA: 'Amaya',
ANDROID: 'Android Browser',
@ -36,11 +37,11 @@ const Browser = Object.freeze({
CHROMIUM: 'Chromium',
COBALT: 'Cobalt',
COC_COC: 'Coc Coc',
COMODO_DRAGON: 'Comodo Dragon',
CONKEROR: 'Conkeror',
DILLO: 'Dillo',
DOLPHIN: 'Dolphin',
DORIS: 'Doris',
DRAGON: 'Dragon',
DUCKDUCKGO: 'DuckDuckGo',
EDGE: 'Edge',
EPIPHANY: 'Epiphany',
@ -78,6 +79,7 @@ const Browser = Object.freeze({
KLARNA: 'Klarna',
KINDLE: 'Kindle',
LENOVO: 'Smart Lenovo Browser',
LIBREWOLF: 'LibreWolf',
LIEBAO: 'LBBROWSER',
LINE: 'Line',
LINKEDIN: 'LinkedIn',
@ -126,7 +128,9 @@ const Browser = Object.freeze({
SILK: 'Silk',
SKYFIRE: 'Skyfire',
SLEIPNIR: 'Sleipnir',
SLIMBOAT: 'SlimBoat',
SLIMBROWSER: 'SlimBrowser',
SLIMJET: 'Slimjet',
SNAPCHAT: 'Snapchat',
SOGOU_EXPLORER: 'Sogou Explorer',
SOGOU_MOBILE: 'Sogou Mobile',
@ -291,6 +295,10 @@ const OS = Object.freeze({
CENTOS: 'CentOS',
CHROME_OS: 'Chrome OS',
CHROMECAST: 'Chromecast',
CHROMECAST_ANDROID: 'Chromecast Android',
CHROMECAST_FUCHSIA: 'Chromecast Fuchsia',
CHROMECAST_LINUX: 'Chromecast Linux',
CHROMECAST_SMARTSPEAKER: 'Chromecast SmartSpeaker',
CONTIKI: 'Contiki',
DEBIAN: 'Debian',
DEEPIN: 'Deepin',

View File

@ -1,4 +1,4 @@
// Type definitions for Helpers submodule of UAParser.js v2.0.0-beta.3
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.2
// Project: https://github.com/faisalman/ua-parser-js
// Definitions by: Faisal Salman <https://github.com/faisalman>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////
/* Extensions for UAParser.js v2.0.0-rc.1
/* Extensions for UAParser.js v2.0.0-rc.2
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <f@faisalman.com>
AGPLv3 License */

View File

@ -3,7 +3,7 @@
// Source: /src/extensions/ua-parser-extensions.js
///////////////////////////////////////////////
/* Extensions for UAParser.js v2.0.0-rc.1
/* Extensions for UAParser.js v2.0.0-rc.2
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <f@faisalman.com>
AGPLv3 License */

View File

@ -1,4 +1,4 @@
// Type definitions for Helpers submodule of UAParser.js v2.0.0-beta.3
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.2
// Project: https://github.com/faisalman/ua-parser-js
// Definitions by: Faisal Salman <https://github.com/faisalman>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////
/* Helpers for UAParser.js v2.0.0-rc.1
/* Helpers for UAParser.js v2.0.0-rc.2
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <f@faisalman.com>
AGPLv3 License */

View File

@ -3,7 +3,7 @@
// Source: /src/helpers/ua-parser-helpers.js
///////////////////////////////////////////////
/* Helpers for UAParser.js v2.0.0-rc.1
/* Helpers for UAParser.js v2.0.0-rc.2
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <f@faisalman.com>
AGPLv3 License */
@ -11,9 +11,11 @@
/*jshint esversion: 6 */
import { CPU, OS, Engine } from './enums/ua-parser-enums.mjs';
import { UAParser } from './main/ua-parser.mjs';
import { UAParser } from '../main/ua-parser.mjs';
import { CPU, OS, Engine } from '../enums/ua-parser-enums.mjs';
import { isFromEU } from 'detect-europe-js';
import { isFrozenUA } from 'ua-is-frozen';
import { isStandalonePWA } from 'is-standalone-pwa';
const getDeviceVendor = (model) => UAParser(`Mozilla/5.0 (Linux; Android 10; ${model}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36`).device.vendor;
@ -37,26 +39,17 @@ const isAppleSilicon = (res) => {
return false;
}
const isBot = (res) => ['cli', 'crawler', 'fetcher', 'module'].includes(res.browser.type);
const isChromeFamily = (res) => res.engine.is(Engine.BLINK);
const isElectron = () => !!(process?.versions?.hasOwnProperty('electron') || // node.js
/ electron\//i.test(navigator?.userAgent)); // browser
const isFrozenUA = (ua) => /^Mozilla\/5\.0 \((Windows NT 10\.0; Win64; x64|Macintosh; Intel Mac OS X 10_15_7|X11; Linux x86_64|X11; CrOS x86_64 14541\.0\.0|Fuchsia|Linux; Android 10; K)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/\d+\.0\.0\.0 (Mobile )?Safari\/537\.36/.test(ua);
const isStandalonePWA = () => window && (window.matchMedia('(display-mode: standalone)').matches ||
// iOS
navigator.standalone ||
// Android
document.referrer.startsWith('android-app://') ||
// Windows
window.Windows ||
/trident.+(msapphost|webview)\//i.test(navigator.userAgent) ||
document.referrer.startsWith('app-info://platform/microsoft-store'));
export {
getDeviceVendor,
isAppleSilicon,
isBot,
isChromeFamily,
isElectron,
isFromEU,

View File

@ -1,4 +1,4 @@
// Type definitions for UAParser.js v2.0.0-beta.3
// Type definitions for UAParser.js v2.0.0-rc.2
// Project: https://github.com/faisalman/ua-parser-js
// Definitions by: Faisal Salman <https://github.com/faisalman>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////////
/* UAParser.js v2.0.0-rc.1
/* UAParser.js v2.0.0-rc.2
Copyright © 2012-2024 Faisal Salman <f@faisalman.com>
AGPLv3 License *//*
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
@ -19,7 +19,7 @@
// Constants
/////////////
var LIBVERSION = '2.0.0-rc.1',
var LIBVERSION = '2.0.0-rc.2',
EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',

View File

@ -3,7 +3,7 @@
// Source: /src/main/ua-parser.js
/////////////////////////////////////////////////////////////////////////////////
/* UAParser.js v2.0.0-rc.1
/* UAParser.js v2.0.0-rc.2
Copyright © 2012-2024 Faisal Salman <f@faisalman.com>
AGPLv3 License *//*
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
@ -21,7 +21,7 @@
// Constants
/////////////
var LIBVERSION = '2.0.0-rc.1',
var LIBVERSION = '2.0.0-rc.2',
EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
@ -42,6 +42,7 @@
WEARABLE = 'wearable',
XR = 'xr',
EMBEDDED = 'embedded',
INAPP = 'inapp',
USER_AGENT = 'user-agent',
UA_MAX_LENGTH = 500,
BRANDS = 'brands',
@ -322,17 +323,19 @@
// Mixed
/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu
], [VERSION, [NAME, 'Baidu']], [
/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon
], [VERSION, [NAME, 'Maxthon']], [
/(kindle)\/([\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir
// Trident based
/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser
/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, // Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet
/(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
// Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio)\/([-\w\.]+)/i,
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio
/(heytap|ovi)browser\/([\d\.]+)/i, // HeyTap/Ovi
// Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon
/(heytap|ovi|115)browser\/([\d\.]+)/i, // HeyTap/Ovi/115
/(weibo)__([\d\.]+)/i // Weibo
], [NAME, VERSION], [
/quark(?:pc)?\/([-\w\.]+)/i // Quark
@ -369,31 +372,31 @@
], [VERSION, [NAME, 'MIUI' + SUFFIX_BROWSER]], [
/fxios\/([\w\.-]+)/i // Firefox for iOS
], [VERSION, [NAME, PREFIX_MOBILE + FIREFOX]], [
/\bqihu|(qi?ho?o?|360)browser/i // 360
], [[NAME, '360' + SUFFIX_BROWSER]], [
/\bqihoobrowser\/?([\w\.]*)/i // 360
], [VERSION, [NAME, '360']], [
/\b(qq)\/([\w\.]+)/i // QQ
], [[NAME, /(.+)/, '$1Browser'], VERSION], [
/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser
/samsungbrowser\/([\w\.]+)/i // Samsung Internet
], [VERSION, [NAME, SAMSUNG + ' Internet']], [
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION], [
/metasr[\/ ]?([\d\.]+)/i // Sogou Explorer
], [VERSION, [NAME, SOGOU + ' Explorer']], [
/(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile
], [[NAME, SOGOU + ' Mobile'], VERSION], [
/(electron)\/([\w\.]+) safari/i, // Electron-based App
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla
/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i // QQBrowser/2345 Browser
/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i // QQ/2345
], [NAME, VERSION], [
/(lbbrowser|rekonq)/i, // LieBao Browser/Rekonq
/\[(linkedin)app\]/i // LinkedIn App for iOS & Android
/(lbbrowser|rekonq)/i // LieBao Browser/Rekonq
], [NAME], [
/ome\/([\w\.]+) \w* ?(iron) saf/i, // Iron
/ome\/([\w\.]+).+qihu (360)[es]e/i // 360
], [VERSION, NAME], [
// WebView
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
], [[NAME, FACEBOOK], VERSION], [
], [[NAME, FACEBOOK], VERSION, [TYPE, INAPP]], [
/(Klarna)\/([\w\.]+)/i, // Klarna Shopping Browser for iOS & Android
/(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App
/(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp
@ -401,12 +404,17 @@
/\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
/(alipay)client\/([\w\.]+)/i, // Alipay
/(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter
/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i // Chromium/Instagram/Snapchat
], [NAME, VERSION], [
/(instagram|snapchat)[\/ ]([-\w\.]+)/i // Instagram/Snapchat
], [NAME, VERSION, [TYPE, INAPP]], [
/\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
], [VERSION, [NAME, 'GSA']], [
], [VERSION, [NAME, 'GSA'], [TYPE, INAPP]], [
/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok
], [VERSION, [NAME, 'TikTok']], [
], [VERSION, [NAME, 'TikTok'], [TYPE, INAPP]], [
/\[(linkedin)app\]/i // LinkedIn App for iOS & Android
], [NAME, [TYPE, INAPP]], [
/(chromium)[\/ ]([-\w\.]+)/i // Chromium
], [NAME, VERSION], [
/headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
], [VERSION, [NAME, CHROME+' Headless']], [
@ -440,7 +448,7 @@
], [[NAME, PREFIX_MOBILE + FIREFOX], VERSION], [
/(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape
], [[NAME, 'Netscape'], VERSION], [
/(wolvic)\/([\w\.]+)/i // Wolvic
/(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf
], [NAME, VERSION], [
/mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality
], [VERSION, [NAME, FIREFOX+' Reality']], [