@browserless/lighthouse 9.9.0 → 9.9.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.
- package/package.json +5 -5
- package/src/index.js +2 -13
- package/src/lighthouse.js +3 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/lighthouse",
|
|
3
3
|
"description": "Browserless Lighthouse integration using puppeteer.",
|
|
4
4
|
"homepage": "https://browserless.js.org",
|
|
5
|
-
"version": "9.9.
|
|
5
|
+
"version": "9.9.3",
|
|
6
6
|
"main": "src",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"lighthouse": "~10.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@browserless/test": "^9.
|
|
31
|
-
"ava": "
|
|
30
|
+
"@browserless/test": "^9.9.3",
|
|
31
|
+
"ava": "latest",
|
|
32
32
|
"browserless": "latest"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"ava": {
|
|
45
45
|
"serial": true,
|
|
46
46
|
"timeout": "30s",
|
|
47
|
-
"
|
|
47
|
+
"workerThreads": false
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "37f98091cbd58ac697b1194c5f786a9eb252f82f"
|
|
50
50
|
}
|
package/src/index.js
CHANGED
|
@@ -3,24 +3,13 @@
|
|
|
3
3
|
const lighthouse = require('./lighthouse')
|
|
4
4
|
const getConfig = require('./get-config')
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
const getFlags = ({ disableStorageReset = true, logLevel = 'error', output = 'json' }) => ({
|
|
8
|
-
disableStorageReset,
|
|
9
|
-
logLevel,
|
|
10
|
-
output
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
module.exports = getBrowserless => async (
|
|
14
|
-
url,
|
|
15
|
-
{ timeout, disableStorageReset, logLevel, output, ...opts } = {}
|
|
16
|
-
) => {
|
|
6
|
+
module.exports = getBrowserless => async (url, { output = 'json', timeout, ...opts } = {}) => {
|
|
17
7
|
let teardown
|
|
18
8
|
const browserless = await getBrowserless(fn => (teardown = fn))
|
|
19
9
|
|
|
20
10
|
const fn = page => async () =>
|
|
21
11
|
lighthouse({
|
|
22
|
-
config: await getConfig(opts),
|
|
23
|
-
flags: getFlags({ disableStorageReset, logLevel, output }),
|
|
12
|
+
config: await getConfig({ ...opts, output }),
|
|
24
13
|
page,
|
|
25
14
|
url
|
|
26
15
|
})
|
package/src/lighthouse.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const lighthouse = require('lighthouse/core/index.cjs')
|
|
4
4
|
|
|
5
|
-
module.exports = async ({ url,
|
|
6
|
-
const { lhr, report } = await lighthouse(url,
|
|
7
|
-
return
|
|
5
|
+
module.exports = async ({ url, config, page }) => {
|
|
6
|
+
const { lhr, report } = await lighthouse(url, undefined, config, page)
|
|
7
|
+
return config.settings.output === 'json' ? lhr : report
|
|
8
8
|
}
|