@jsenv/core 24.5.4 → 24.5.8
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/{license → LICENSE} +0 -0
- package/dist/build_manifest.js +4 -4
- package/dist/compile_proxy/asset-manifest.json +1 -1
- package/dist/compile_proxy/{compile_proxy-1dfca609.html → compile_proxy-a3969633.html} +36 -3
- package/dist/compile_proxy/{compile_proxy.html__inline__20-672ba17c.js.map → compile_proxy.html__inline__20-9c92c170.js.map} +10 -4
- package/dist/redirector/asset-manifest.json +1 -1
- package/dist/redirector/{redirector-d1316407.html → redirector-a6b8d640.html} +36 -3
- package/dist/redirector/{redirector.html__inline__15-4d453af0.js.map → redirector.html__inline__15-58430672.js.map} +10 -4
- package/dist/toolbar/asset-manifest.json +1 -1
- package/dist/toolbar/{toolbar-afb71355.html → toolbar-84985f43.html} +36 -3
- package/dist/toolbar/{toolbar.main-feac7fa3.js.map → toolbar.main-7aa01366.js.map} +10 -4
- package/dist/toolbar_injector/asset-manifest.json +1 -1
- package/dist/toolbar_injector/{toolbar_injector-445d3ea0.js → toolbar_injector-8edcae04.js} +2 -2
- package/dist/toolbar_injector/{toolbar_injector-445d3ea0.js.map → toolbar_injector-8edcae04.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 +3 -1
- package/src/internal/browser_detection/user_agent_data.js +26 -0
- package/src/jsenvServiceWorkerFinalizer.js +4 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { userAgentToVersion, firstMatch } from "./util.js"
|
|
2
2
|
|
|
3
|
-
export const detectChrome = () =>
|
|
3
|
+
export const detectChrome = () => {
|
|
4
|
+
return userAgentToBrowser(window.navigator.userAgent)
|
|
5
|
+
}
|
|
4
6
|
|
|
5
7
|
const userAgentToBrowser = (userAgent) => {
|
|
6
8
|
if (/chromium/i.test(userAgent)) {
|
|
@@ -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.length) {
|
|
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
|
+
}
|
|
@@ -27,6 +27,10 @@ export const jsenvServiceWorkerFinalizer = (
|
|
|
27
27
|
buildUrl,
|
|
28
28
|
serviceWorkerBuildUrl,
|
|
29
29
|
)
|
|
30
|
+
if (urlRelativeToServiceWorker === "") {
|
|
31
|
+
// don't put the service worker itself
|
|
32
|
+
return
|
|
33
|
+
}
|
|
30
34
|
const versioned = fileNameContainsHash(buildRelativeUrl)
|
|
31
35
|
const rollupFile = rollupBuild[buildRelativeUrl]
|
|
32
36
|
|