phantomas 2.5.0 → 2.7.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/Dockerfile CHANGED
@@ -41,9 +41,15 @@ COPY package.json .
41
41
  COPY package-lock.json .
42
42
  RUN npm ci
43
43
 
44
- # TODO: find the chrome binary and symlink it to the PATH
45
- RUN ldd $(find . -wholename '*chrome-linux/chrome') && \
46
- $(find . -wholename '*chrome-linux/chrome') --version
44
+ # find the chrome binary and symlink it to the PATH
45
+ # e.g. ./.cache/puppeteer/chrome/linux-112.0.5615.121/chrome-linux64/chrome
46
+ RUN echo "Chrome found in: " $(find . -wholename '*chrome-linux64/chrome') && \
47
+ ln -s $(find . -wholename '*chrome-linux64/chrome') .
48
+
49
+ ENV PATH ${PATH}":/opt/phantomas"
50
+
51
+ RUN ldd chrome && \
52
+ chrome --version
47
53
 
48
54
  ARG GITHUB_SHA="dev"
49
55
  ENV COMMIT_SHA ${GITHUB_SHA}
package/README.md CHANGED
@@ -10,7 +10,7 @@ phantomas
10
10
 
11
11
  ## Requirements
12
12
 
13
- * [NodeJS](http://nodejs.org) 14+
13
+ * [NodeJS](http://nodejs.org) 16+
14
14
 
15
15
  ## Installation
16
16
 
@@ -29,7 +29,7 @@ module.exports = function (phantomas) {
29
29
  };
30
30
 
31
31
  phantomas.on("init", async (page) => {
32
- // @see https://github.com/puppeteer/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport
32
+ // @see https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.setviewport.md
33
33
  await page.setViewport(options);
34
34
  phantomas.log("page.setViewport() called with options %j", options);
35
35
  });
package/lib/browser.js CHANGED
@@ -26,7 +26,13 @@ Browser.prototype.init = async (phantomasOptions) => {
26
26
  // page.evaluate throw "Protocol error (Runtime.callFunctionOn): Target closed." without the following
27
27
  // https://github.com/GoogleChrome/puppeteer/issues/1175#issuecomment-369728215
28
28
  "--disable-dev-shm-usage",
29
+
30
+ // make sure to default the viewport to a specific size
31
+ "--window-size=800,600",
29
32
  ],
33
+ // use the new Headless mode for Chrome
34
+ // https://developer.chrome.com/articles/new-headless/
35
+ headless: "new",
30
36
  };
31
37
 
32
38
  // handle Phantomas options
@@ -70,7 +76,7 @@ Browser.prototype.init = async (phantomasOptions) => {
70
76
  debug("Launching Puppeteer: %j", options);
71
77
 
72
78
  try {
73
- // https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#puppeteerlaunchoptions
79
+ // https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.browserlaunchargumentoptions.md
74
80
  this.browser = await puppeteer.launch(options);
75
81
  this.page = await this.browser.newPage();
76
82
  } catch (ex) /* istanbul ignore next */ {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phantomas",
3
- "version": "2.5.0",
3
+ "version": "2.7.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",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "license": "BSD-2-Clause",
26
26
  "engines": {
27
- "node": ">=14.0"
27
+ "node": ">=16.0"
28
28
  },
29
29
  "dependencies": {
30
30
  "analyze-css": "^2.0.0",
@@ -33,7 +33,7 @@
33
33
  "decamelize": "^5.0.0",
34
34
  "fast-stats": "0.0.6",
35
35
  "js-yaml": "^4.0.0",
36
- "puppeteer": "^14.4.1"
36
+ "puppeteer": "^20.5.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@jest/globals": "^28.0.0",