@jsenv/core 41.1.0 → 41.1.1

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.
@@ -9608,15 +9608,17 @@ const parseSecChUaHeader = (secChUa) => {
9608
9608
  brand = brands[0];
9609
9609
  }
9610
9610
  const runtimeName = brandNameToRuntimeName(brand.name);
9611
- const runtimeVersion = brand.version;
9611
+ const runtimeVersion = `${brand.version}.0.0`;
9612
9612
  return { runtimeName, runtimeVersion };
9613
9613
  };
9614
-
9615
9614
  const brandNameToRuntimeName = (brandName) => {
9616
9615
  const lower = brandName.toLowerCase();
9617
9616
  if (lower === "google chrome") {
9618
9617
  return "chrome";
9619
9618
  }
9619
+ if (lower === "headlesschrome") {
9620
+ return "chrome";
9621
+ }
9620
9622
  if (lower === "microsoft edge") {
9621
9623
  return "edge";
9622
9624
  }
@@ -9629,7 +9631,8 @@ const brandNameToRuntimeName = (brandName) => {
9629
9631
  if (lower === "chromium") {
9630
9632
  return "chrome";
9631
9633
  }
9632
- return lower;
9634
+ // other Chromium-based browsers share Chrome's compatibility
9635
+ return "chrome";
9633
9636
  };
9634
9637
 
9635
9638
  const parseUserAgentHeader = (userAgent) => {
@@ -9673,7 +9676,9 @@ const parseUserAgentHeader = (userAgent) => {
9673
9676
  return { runtimeName: "firefox", runtimeVersion: `${major}.${minor}.0` };
9674
9677
  }
9675
9678
  // generic Chromium-based fallback (should normally be handled by sec-ch-ua)
9676
- const chromeMatch = userAgent.match(/\bChrome\/(\d+)\.(\d+)\b/);
9679
+ const chromeMatch = userAgent.match(
9680
+ /(?:HeadlessChrome|Chrome)\/(\d+)\.(\d+)\b/,
9681
+ );
9677
9682
  if (chromeMatch) {
9678
9683
  const major = chromeMatch[1];
9679
9684
  const minor = chromeMatch[2] || "0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "41.1.0",
3
+ "version": "41.1.1",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,15 +47,17 @@ const parseSecChUaHeader = (secChUa) => {
47
47
  brand = brands[0];
48
48
  }
49
49
  const runtimeName = brandNameToRuntimeName(brand.name);
50
- const runtimeVersion = brand.version;
50
+ const runtimeVersion = `${brand.version}.0.0`;
51
51
  return { runtimeName, runtimeVersion };
52
52
  };
53
-
54
53
  const brandNameToRuntimeName = (brandName) => {
55
54
  const lower = brandName.toLowerCase();
56
55
  if (lower === "google chrome") {
57
56
  return "chrome";
58
57
  }
58
+ if (lower === "headlesschrome") {
59
+ return "chrome";
60
+ }
59
61
  if (lower === "microsoft edge") {
60
62
  return "edge";
61
63
  }
@@ -68,7 +70,8 @@ const brandNameToRuntimeName = (brandName) => {
68
70
  if (lower === "chromium") {
69
71
  return "chrome";
70
72
  }
71
- return lower;
73
+ // other Chromium-based browsers share Chrome's compatibility
74
+ return "chrome";
72
75
  };
73
76
 
74
77
  const parseUserAgentHeader = (userAgent) => {
@@ -112,7 +115,9 @@ const parseUserAgentHeader = (userAgent) => {
112
115
  return { runtimeName: "firefox", runtimeVersion: `${major}.${minor}.0` };
113
116
  }
114
117
  // generic Chromium-based fallback (should normally be handled by sec-ch-ua)
115
- const chromeMatch = userAgent.match(/\bChrome\/(\d+)\.(\d+)\b/);
118
+ const chromeMatch = userAgent.match(
119
+ /(?:HeadlessChrome|Chrome)\/(\d+)\.(\d+)\b/,
120
+ );
116
121
  if (chromeMatch) {
117
122
  const major = chromeMatch[1];
118
123
  const minor = chromeMatch[2] || "0";