phantomas 2.10.0 → 2.11.0
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.
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
module.exports = function (phantomas) {
|
|
7
7
|
const puppeteer = require("puppeteer"),
|
|
8
|
-
devices = puppeteer.
|
|
9
|
-
// @see https://github.com/
|
|
8
|
+
devices = puppeteer.KnownDevices,
|
|
9
|
+
// @see https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/common/Device.ts
|
|
10
10
|
availableDevices = {
|
|
11
11
|
phone: "Galaxy S5", // 360x640
|
|
12
12
|
"phone-landscape": "Galaxy S5 landscape", // 640x360
|
|
@@ -14,7 +14,7 @@ module.exports = function (phantomas) {
|
|
|
14
14
|
"tablet-landscape": "Kindle Fire HDX landscape", // 1280x800
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
let device;
|
|
18
18
|
|
|
19
19
|
// check if --phone or --tablet option was passed
|
|
20
20
|
Object.keys(availableDevices).forEach(function (item) {
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
+
const { setTimeout } = require("timers/promises");
|
|
7
|
+
|
|
6
8
|
module.exports = function (phantomas) {
|
|
7
9
|
// e.g. --post-load-delay 5
|
|
8
10
|
var delay = parseInt(phantomas.getParam("post-load-delay"), 10);
|
|
@@ -14,9 +16,9 @@ module.exports = function (phantomas) {
|
|
|
14
16
|
// https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#framewaitforselectororfunctionortimeout-options-args
|
|
15
17
|
phantomas.log("Will wait %d second(s) after load", delay);
|
|
16
18
|
|
|
17
|
-
phantomas.on("beforeClose", (
|
|
19
|
+
phantomas.on("beforeClose", async () => {
|
|
18
20
|
phantomas.log("Sleeping for %d seconds", delay);
|
|
19
21
|
|
|
20
|
-
return
|
|
22
|
+
return setTimeout(delay * 1000);
|
|
21
23
|
});
|
|
22
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phantomas",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"author": "macbre <maciej.brencz@gmail.com> (http://macbre.net)",
|
|
5
5
|
"description": "Headless Chromium-based web performance metrics collector and monitoring tool",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"node": ">=16.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"analyze-css": "^2.
|
|
30
|
+
"analyze-css": "^2.1.89",
|
|
31
31
|
"analyze-image": "^1.0.0",
|
|
32
32
|
"commander": "^9.0.0",
|
|
33
33
|
"debug": "^4.1.1",
|
|
34
34
|
"decamelize": "^5.0.0",
|
|
35
35
|
"fast-stats": "0.0.6",
|
|
36
36
|
"js-yaml": "^4.0.0",
|
|
37
|
-
"puppeteer": "^
|
|
37
|
+
"puppeteer": "^22.4.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@jest/globals": "^28.0.0",
|