Rearrange the structure of src folders

This commit is contained in:
Faisal Salman
2023-04-21 09:47:51 +07:00
parent 29fb85658a
commit 9102871dea
10 changed files with 55 additions and 51 deletions

View File

@@ -1,6 +1,6 @@
// Generated ESM version of UAParser.js enums
// DO NOT EDIT THIS FILE!
// Source: /src/ua-parser-enum.js
// Source: /src/enums/ua-parser-enums.js
///////////////////////////////////////////////
/* Enums for UAParser.js v2.0.0-alpha.2

View File

@@ -1,6 +1,6 @@
// Generated ESM version of UAParser.js extensions
// DO NOT EDIT THIS FILE!
// Source: /src/ua-parser-extension.js
// Source: /src/extensions/ua-parser-extensions.js
///////////////////////////////////////////////
/* Extensions for UAParser.js v2.0.0-alpha.2
@@ -19,10 +19,19 @@ const VERSION = 'version';
const MOBILE = 'mobile';
const TABLET = 'tablet';
const Apps = Object.freeze({
browser : [
[/chatlyio\/([\d\.]+)/i], [VERSION, 'Slack', [TYPE, 'app']]
]
});
const Bots = Object.freeze({
browser : [
// Googlebot / BingBot / MSNBot / FacebookBot
[/((?:google|bing|msn|facebook)bot(?:\-[imagevdo]{5})?|bingpreview)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'bot']]
// Googlebot / BingBot / MSNBot / FacebookBot
[/((?:google|bing|msn|facebook)bot(?:\-[imagevdo]{5})?|bingpreview)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'bot']],
// Slackbot - https://api.slack.com/robots
[/(slack(?:bot)?(?:-imgproxy|-linkexpanding)?) ([\w\.]+)/i], [NAME, VERSION, [TYPE, 'bot']]
]
});
@@ -111,16 +120,17 @@ const Emails = Object.freeze({
]
});
const Tools = Object.freeze({
const CLI = Object.freeze({
browser : [
// wget / curl / lynx
[/(wget|curl|lynx)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'tool']]
[/(wget|curl|lynx)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'cli']]
]
});
export {
Apps,
Bots,
ExtraDevices,
Emails,
Tools
CLI
};

View File

@@ -1,6 +1,6 @@
// Generated ESM version of UAParser.js
// Generated ESM version of UAParser.js
// DO NOT EDIT THIS FILE!
// Source: /src/ua-parser.js
// Source: /src/main/ua-parser.js
/////////////////////////////////////////////////////////////////////////////////
/* UAParser.js v2.0.0-alpha.2
@@ -734,7 +734,7 @@
// iOS/macOS
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS
/ios;fbsv\/([\d\.]+)/i,
/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,
/cfnetwork\/.+darwin/i
], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
/(mac os x) ?([\w\. ]*)/i,
@@ -920,10 +920,10 @@
// Constructor
////////////////
function UACHData (uach, isHTTP_UACH) {
function UACHData (uach, isHttpUACH) {
uach = uach || {};
setProps.call(this, CH_ALL_VALUES);
if (isHTTP_UACH) {
if (isHttpUACH) {
setProps.call(this, [
[BRANDS, itemListToArray(uach[CH_HEADER])],
[FULLVERLIST, itemListToArray(uach[CH_HEADER_FULL_VER_LIST])],
@@ -1108,15 +1108,12 @@
return new UAParser(ua, extensions, headers).getResult();
}
var userAgent = ua ||
((NAVIGATOR && NAVIGATOR.userAgent) ?
NAVIGATOR.userAgent :
(headers && headers[USER_AGENT] ?
headers[USER_AGENT] :
EMPTY)),
HTTP_UACH = new UACHData(headers, true),
var userAgent = typeof ua === STR_TYPE ? ua : // Passed user-agent string
((NAVIGATOR && NAVIGATOR.userAgent) ? NAVIGATOR.userAgent : // navigator.userAgent
(headers && headers[USER_AGENT] ? headers[USER_AGENT] : // User-Agent from passed headers
EMPTY)), // empty string
httpUACH = new UACHData(headers, true),
regexMap = extensions ?
extend(defaultRegexes, extensions) :
defaultRegexes,
@@ -1124,7 +1121,7 @@
createItemFunc = function (itemType) {
if (itemType == UA_RESULT) {
return function () {
return new UAItem(itemType, userAgent, regexMap, HTTP_UACH)
return new UAItem(itemType, userAgent, regexMap, httpUACH)
.set('ua', userAgent)
.set(UA_BROWSER, this.getBrowser())
.set(UA_CPU, this.getCPU())
@@ -1135,13 +1132,13 @@
};
} else {
return function () {
return new UAItem(itemType, userAgent, regexMap[itemType], HTTP_UACH)
return new UAItem(itemType, userAgent, regexMap[itemType], httpUACH)
.parseUA()
.get();
};
}
};
// public methods
setProps.call(this, [
['getBrowser', createItemFunc(UA_BROWSER)],