pageres
Advanced tools
Comparing version 6.1.0 to 6.2.0
@@ -7,2 +7,3 @@ "use strict"; | ||
const fs = require("fs"); | ||
const os = require("os"); | ||
const events_1 = require("events"); | ||
@@ -23,3 +24,5 @@ const pMemoize = require("p-memoize"); | ||
const filenamifyUrl = require("filenamify-url"); | ||
const pMap = require("p-map"); | ||
const writeFile = util_1.promisify(fs.writeFile); | ||
const cpuCount = os.cpus().length; | ||
const getResolutionsMemoized = pMemoize(getResolutions); | ||
@@ -34,3 +37,3 @@ // @ts-expect-error | ||
// Prevent false-positive `MaxListenersExceededWarning` warnings | ||
this.setMaxListeners(Infinity); | ||
this.setMaxListeners(Number.POSITIVE_INFINITY); | ||
this.options = Object.assign({}, options); | ||
@@ -84,7 +87,7 @@ this.options.filename = (_a = this.options.filename) !== null && _a !== void 0 ? _a : '<%= url %>-<%= size %><%= crop %>'; | ||
} | ||
for (const size of sizes) { | ||
const screenshots = await pMap(sizes, async (size) => { | ||
this.sizes.push(size); | ||
// TODO: Make this concurrent | ||
this.items.push(await this.create(source.url, size, options)); | ||
} | ||
return this.create(source.url, size, options); | ||
}, { concurrency: cpuCount * 2 }); | ||
this.items.push(...screenshots); | ||
return undefined; | ||
@@ -91,0 +94,0 @@ })); |
{ | ||
"name": "pageres", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"description": "Capture website screenshots", | ||
@@ -79,3 +79,3 @@ "license": "MIT", | ||
"@types/node": "^14.14.13", | ||
"@types/pify": "^3.0.2", | ||
"@types/pify": "^5.0.0", | ||
"@types/png.js": "^0.2.0", | ||
@@ -97,3 +97,3 @@ "@types/sinon": "^9.0.9", | ||
"typescript": "^4.1.3", | ||
"xo": "^0.36.1" | ||
"xo": "^0.38.2" | ||
}, | ||
@@ -119,2 +119,6 @@ "types": "dist/index.d.ts", | ||
"nyc": { | ||
"reporter": [ | ||
"text", | ||
"lcov" | ||
], | ||
"extension": [ | ||
@@ -121,0 +125,0 @@ ".ts" |
# ![pageres](media/promo.png) | ||
[![Coverage Status](https://codecov.io/gh/sindresorhus/pageres/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/pageres) | ||
[![Coverage Status](https://codecov.io/gh/sindresorhus/pageres/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/pageres) | ||
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) | ||
@@ -5,0 +5,0 @@ |
18311
245