browserless 13.5.0 → 13.5.3

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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/src/report.js +33 -3
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "browserless",
3
3
  "description": "The headless Chrome/Chromium driver on top of Puppeteer. Take screenshots, generate PDFs, extract text and HTML with a production-ready API.",
4
4
  "homepage": "https://browserless.js.org",
5
- "version": "13.5.0",
5
+ "version": "13.5.3",
6
6
  "types": "index.d.ts",
7
7
  "main": "src/index.js",
8
8
  "author": {
@@ -36,9 +36,9 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@browserless/errors": "13.1.7",
39
- "@browserless/goto": "13.4.1",
40
- "@browserless/pdf": "13.4.1",
41
- "@browserless/screenshot": "13.4.1",
39
+ "@browserless/goto": "13.5.3",
40
+ "@browserless/pdf": "13.5.3",
41
+ "@browserless/screenshot": "13.5.3",
42
42
  "debug-logfmt": "~1.4.10",
43
43
  "kill-process-group": "~1.0.13",
44
44
  "p-reflect": "~2.1.0",
@@ -48,7 +48,7 @@
48
48
  "superlock": "~1.2.7"
49
49
  },
50
50
  "devDependencies": {
51
- "@browserless/test": "13.5.0",
51
+ "@browserless/test": "13.5.3",
52
52
  "ava": "5",
53
53
  "ps-list": "7",
54
54
  "puppeteer": "25",
@@ -70,5 +70,5 @@
70
70
  "timeout": "2m",
71
71
  "workerThreads": false
72
72
  },
73
- "gitHead": "000c5ca9e84696666e3c652a9a0a2dab325e9576"
73
+ "gitHead": "3aed0ceefb700a38debc5be98241a7985818c88d"
74
74
  }
package/src/report.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const { execFile } = require('child_process')
4
- const { readFileSync, existsSync } = require('fs')
4
+ const { readFileSync, readdirSync, existsSync } = require('fs')
5
5
  const { promisify } = require('util')
6
6
  const os = require('os')
7
7
 
@@ -225,9 +225,38 @@ const parseRenderer = renderer => {
225
225
  }
226
226
  }
227
227
 
228
- // ANGLE hides the underlying Mesa version, so read it from the installed driver
229
- // package. Best-effort: null off Debian/Ubuntu (e.g. macOS dev) or if dpkg fails.
228
+ // Directories where the loaded Mesa Gallium driver may live. The multiarch path
229
+ // is resolved at runtime so this works on amd64 and arm64 without a hardcode.
230
+ const GALLIUM_LIB_DIRS = [
231
+ `/usr/lib/${process.arch === 'arm64' ? 'aarch64' : 'x86_64'}-linux-gnu`,
232
+ '/usr/lib',
233
+ '/usr/local/lib'
234
+ ]
235
+
236
+ // Modern Mesa ships the version in the shared-object filename, e.g.
237
+ // `libgallium-26.1.3.so`. Pure so it can be unit-tested without a filesystem.
238
+ const parseGalliumVersion = filenames => {
239
+ for (const name of filenames) {
240
+ const m = /^libgallium-(\d+\.\d+(?:\.\d+)?)\.so$/.exec(name)
241
+ if (m) return m[1]
242
+ }
243
+ return null
244
+ }
245
+
246
+ // ANGLE hides the underlying Mesa version. Read it from the ACTUALLY loaded
247
+ // Gallium driver (`libgallium-<ver>.so`) first — when Mesa is side-loaded over
248
+ // the distro package (our Docker image COPYs a source build over apt's), dpkg
249
+ // still reports the stale apt version while this reflects what Chromium loads.
250
+ // Fall back to the dpkg package version, then null (e.g. macOS dev, no Mesa).
230
251
  const readMesaVersion = async () => {
252
+ for (const dir of GALLIUM_LIB_DIRS) {
253
+ try {
254
+ const version = parseGalliumVersion(readdirSync(dir))
255
+ if (version) return version
256
+ } catch {
257
+ // dir absent / unreadable — try the next candidate.
258
+ }
259
+ }
231
260
  try {
232
261
  // Default output is `<name>\t<version>`; take the version field.
233
262
  const { stdout } = await execFileAsync('dpkg-query', ['-W', 'libgl1-mesa-dri'], {
@@ -449,4 +478,5 @@ const report =
449
478
 
450
479
  module.exports = report
451
480
  module.exports.parseRenderer = parseRenderer
481
+ module.exports.parseGalliumVersion = parseGalliumVersion
452
482
  module.exports.detectBuild = detectBuild