phantomas 2.12.0 → 2.13.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.
package/bin/phantomas.js
CHANGED
|
@@ -22,8 +22,7 @@ let options = parseArgv(process.argv);
|
|
|
22
22
|
if (typeof options.url !== "string" && typeof options.config === "undefined") {
|
|
23
23
|
debug("URL not provided - show help and leave");
|
|
24
24
|
getProgram().outputHelp();
|
|
25
|
-
process.
|
|
26
|
-
return;
|
|
25
|
+
process.exit(1);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
url = options.url;
|
|
@@ -40,7 +40,7 @@ function parseEntryUrl(entry) {
|
|
|
40
40
|
entry.protocol = false;
|
|
41
41
|
entry.isBlob = true;
|
|
42
42
|
} else {
|
|
43
|
-
parsed = new URL(entry.url)
|
|
43
|
+
parsed = new URL(entry.url);
|
|
44
44
|
|
|
45
45
|
entry.protocol = parsed.protocol.replace(":", ""); // e.g. "http:"
|
|
46
46
|
entry.domain = parsed.hostname;
|
package/core/scope.js
CHANGED
package/eslint.config.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const globals = require("globals");
|
|
2
|
+
const js = require("@eslint/js");
|
|
3
|
+
|
|
4
|
+
const eslintConfigPrettier = require("eslint-config-prettier");
|
|
5
|
+
|
|
6
|
+
module.exports = [
|
|
7
|
+
js.configs.recommended,
|
|
8
|
+
eslintConfigPrettier,
|
|
9
|
+
{
|
|
10
|
+
languageOptions: {
|
|
11
|
+
ecmaVersion: 2022,
|
|
12
|
+
sourceType: "script",
|
|
13
|
+
globals: {
|
|
14
|
+
// https://eslint.org/docs/latest/use/configure/language-options#predefined-global-variables
|
|
15
|
+
...globals.node,
|
|
16
|
+
...globals.browser,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
"prefer-const": "off",
|
|
21
|
+
"no-console": "off",
|
|
22
|
+
"no-async-promise-executor": "off",
|
|
23
|
+
// https://eslint.org/docs/latest/rules/no-unused-vars
|
|
24
|
+
"no-unused-vars": [
|
|
25
|
+
"error",
|
|
26
|
+
{
|
|
27
|
+
vars: "all",
|
|
28
|
+
args: "after-used",
|
|
29
|
+
caughtErrors: "none", // ignore catch block variables
|
|
30
|
+
ignoreRestSiblings: false,
|
|
31
|
+
reportUsedIgnorePattern: false,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
ignores: ["coverage/**", "test/webroot/**"],
|
|
38
|
+
},
|
|
39
|
+
];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
-
const { setTimeout } = require("timers/promises");
|
|
6
|
+
const { setTimeout: setTimeoutAsync } = require("timers/promises");
|
|
7
7
|
|
|
8
8
|
module.exports = function (phantomas) {
|
|
9
9
|
// e.g. --post-load-delay 5
|
|
@@ -19,6 +19,6 @@ module.exports = function (phantomas) {
|
|
|
19
19
|
phantomas.on("beforeClose", async () => {
|
|
20
20
|
phantomas.log("Sleeping for %d seconds", delay);
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return setTimeoutAsync(delay * 1000);
|
|
23
23
|
});
|
|
24
24
|
};
|
package/lib/browser.js
CHANGED
|
@@ -148,10 +148,11 @@ Browser.prototype.init = async (phantomasOptions) => {
|
|
|
148
148
|
request._initiator = data.initiator;
|
|
149
149
|
|
|
150
150
|
networkDebug(
|
|
151
|
-
"Network.requestWillBeSent > %s %s [%s]",
|
|
151
|
+
"Network.requestWillBeSent > %s %s [%s] headers: %j",
|
|
152
152
|
request.method,
|
|
153
153
|
request.url,
|
|
154
|
-
request._initiator.type
|
|
154
|
+
request._initiator.type,
|
|
155
|
+
request.headers
|
|
155
156
|
);
|
|
156
157
|
|
|
157
158
|
this.events.emit("request", request); // @desc Emitted when page is about to send HTTP request
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phantomas",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.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",
|
|
@@ -34,14 +34,15 @@
|
|
|
34
34
|
"decamelize": "^5.0.0",
|
|
35
35
|
"fast-stats": "0.0.6",
|
|
36
36
|
"js-yaml": "^4.0.0",
|
|
37
|
-
"puppeteer": "^
|
|
37
|
+
"puppeteer": "^23.0.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@eslint/js": "^9.3.0",
|
|
40
41
|
"@jest/globals": "^28.0.0",
|
|
41
|
-
"eslint": "^
|
|
42
|
-
"eslint-config-prettier": "^
|
|
43
|
-
"eslint-plugin-node": "^11.1.0",
|
|
42
|
+
"eslint": "^9.3.0",
|
|
43
|
+
"eslint-config-prettier": "^9.1.0",
|
|
44
44
|
"glob": "^8.0.1",
|
|
45
|
+
"globals": "^15.3.0",
|
|
45
46
|
"jest": "^28.0.0",
|
|
46
47
|
"prettier": "2.7.1"
|
|
47
48
|
},
|