@jsenv/core 24.5.6 → 24.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build_manifest.js +4 -4
- package/dist/compile_proxy/asset-manifest.json +1 -1
- package/dist/compile_proxy/{compile_proxy-4d4349b1.html → compile_proxy-501d6fa3.html} +36 -18
- package/dist/compile_proxy/{compile_proxy.html__inline__20-f94f176c.js.map → compile_proxy.html__inline__20-cbaf7522.js.map} +11 -8
- package/dist/redirector/asset-manifest.json +1 -1
- package/dist/redirector/{redirector-b491ae1d.html → redirector-d614cffb.html} +36 -18
- package/dist/redirector/{redirector.html__inline__15-7a0d16d6.js.map → redirector.html__inline__15-2953c307.js.map} +11 -8
- package/dist/toolbar/asset-manifest.json +1 -1
- package/dist/toolbar/{toolbar-9fb7b5af.html → toolbar-c23caf7b.html} +36 -18
- package/dist/toolbar/{toolbar.main-ece8404d.js.map → toolbar.main-bdbf37d1.js.map} +11 -7
- package/dist/toolbar_injector/asset-manifest.json +1 -1
- package/dist/toolbar_injector/{toolbar_injector-8d0c0d33.js → toolbar_injector-52ec0940.js} +2 -2
- package/dist/toolbar_injector/{toolbar_injector-8d0c0d33.js.map → toolbar_injector-52ec0940.js.map} +2 -2
- package/package.json +1 -1
- package/src/internal/browser_detection/browser_detection.js +2 -0
- package/src/internal/browser_detection/detectChrome.js +0 -12
- package/src/internal/browser_detection/user_agent_data.js +26 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// https://github.com/Ahmdrza/detect-browser/blob/26254f85cf92795655a983bfd759d85f3de850c6/detect-browser.js#L1
|
|
2
2
|
// https://github.com/lancedikson/bowser/blob/master/src/parser-browsers.js#L1
|
|
3
3
|
|
|
4
|
+
import { detectFromUserAgentData } from "./user_agent_data.js"
|
|
4
5
|
import { detectAndroid } from "./detectAndroid.js"
|
|
5
6
|
import { detectInternetExplorer } from "./detectInternetExplorer.js"
|
|
6
7
|
import { detectOpera } from "./detectOpera.js"
|
|
@@ -25,6 +26,7 @@ const detectorCompose = (detectors) => () => {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
const detector = detectorCompose([
|
|
29
|
+
detectFromUserAgentData, // keep this first
|
|
28
30
|
detectOpera,
|
|
29
31
|
detectInternetExplorer,
|
|
30
32
|
detectEdge,
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import { userAgentToVersion, firstMatch } from "./util.js"
|
|
2
2
|
|
|
3
3
|
export const detectChrome = () => {
|
|
4
|
-
const { userAgentData } = window.navigator
|
|
5
|
-
if (userAgentData) {
|
|
6
|
-
const brand = userAgentData.brands.some((brand) => {
|
|
7
|
-
return brand.brand === "chromium" || brand.brand === "Google Chrome"
|
|
8
|
-
})
|
|
9
|
-
if (brand) {
|
|
10
|
-
return {
|
|
11
|
-
name: "chrome",
|
|
12
|
-
version: brand.version,
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
4
|
return userAgentToBrowser(window.navigator.userAgent)
|
|
17
5
|
}
|
|
18
6
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Prefer window.navigator.userAgentData before resorting to
|
|
3
|
+
* window.navigator.userAgent because of
|
|
4
|
+
* https://blog.chromium.org/2021/09/user-agent-reduction-origin-trial-and-dates.html
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const detectFromUserAgentData = () => {
|
|
8
|
+
const { userAgentData } = window.navigator
|
|
9
|
+
if (!userAgentData) {
|
|
10
|
+
return null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { brands } = userAgentData
|
|
14
|
+
let i = 0
|
|
15
|
+
while (i < brands.legth) {
|
|
16
|
+
const { brand, version } = brands[i]
|
|
17
|
+
i++
|
|
18
|
+
if (brand === "chromium" || brand === "Google Chrome") {
|
|
19
|
+
return {
|
|
20
|
+
name: "chrome",
|
|
21
|
+
version,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null
|
|
26
|
+
}
|