Socket
Socket
Sign inDemoInstall

pageres

Package Overview
Dependencies
Maintainers
3
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pageres - npm Package Compare versions

Comparing version 5.0.2 to 5.1.0

43

dist/index.js

@@ -21,3 +21,3 @@ "use strict";

const array_differ_1 = __importDefault(require("array-differ"));
const easydate_1 = __importDefault(require("easydate"));
const date_fns_1 = __importDefault(require("date-fns"));
const get_res_1 = __importDefault(require("get-res"));

@@ -78,12 +78,12 @@ const log_symbols_1 = __importDefault(require("log-symbols"));

return __awaiter(this, void 0, void 0, function* () {
yield Promise.all(this.src().map((src) => __awaiter(this, void 0, void 0, function* () {
const options = Object.assign({}, this.options, src.options);
const sizes = array_uniq_1.default(src.sizes.filter(/./.test, /^\d{2,4}x\d{2,4}$/i));
const keywords = array_differ_1.default(src.sizes, sizes);
this.urls.push(src.url);
if (sizes.length === 0 && keywords.indexOf('w3counter') !== -1) {
return this.resolution(src.url, options);
yield Promise.all(this.src().map((source) => __awaiter(this, void 0, void 0, function* () {
const options = Object.assign({}, this.options, source.options);
const sizes = array_uniq_1.default(source.sizes.filter(/./.test, /^\d{2,4}x\d{2,4}$/i));
const keywords = array_differ_1.default(source.sizes, sizes);
this.urls.push(source.url);
if (sizes.length === 0 && keywords.includes('w3counter')) {
return this.resolution(source.url, options);
}
if (keywords.length > 0) {
return this.viewport({ url: src.url, sizes, keywords }, options);
return this.viewport({ url: source.url, sizes, keywords }, options);
}

@@ -93,3 +93,3 @@ for (const size of sizes) {

// TODO: Make this concurrent
this.items.push(yield this.create(src.url, size, options));
this.items.push(yield this.create(source.url, size, options));
}

@@ -125,10 +125,10 @@ return undefined;

}
viewport(obj, options) {
viewport(viewport, options) {
return __awaiter(this, void 0, void 0, function* () {
for (const item of yield viewportListMem(obj.keywords)) {
for (const item of yield viewportListMem(viewport.keywords)) {
this.sizes.push(item.size);
obj.sizes.push(item.size);
viewport.sizes.push(item.size);
}
for (const size of array_uniq_1.default(obj.sizes)) {
this.items.push(yield this.create(obj.url, size, options));
for (const size of array_uniq_1.default(viewport.sizes)) {
this.items.push(yield this.create(viewport.url, size, options));
}

@@ -146,6 +146,6 @@ });

}
create(uri, size, options) {
create(url, size, options) {
return __awaiter(this, void 0, void 0, function* () {
const basename = path_1.default.isAbsolute(uri) ? path_1.default.basename(uri) : uri;
let hash = url_1.parse(uri).hash || '';
const basename = path_1.default.isAbsolute(url) ? path_1.default.basename(url) : url;
let hash = url_1.parse(url).hash || '';
// Strip empty hash fragments: `#` `#/` `#!/`

@@ -157,6 +157,7 @@ if (/^#!?\/?$/.test(hash)) {

const filenameTemplate = lodash_template_1.default(`${options.filename}.${options.format}`);
const now = Date.now();
let filename = filenameTemplate({
crop: options.crop ? '-cropped' : '',
date: easydate_1.default('Y-M-d'),
time: easydate_1.default('h-m-s'),
date: date_fns_1.default.format(now, 'YYYY-MM-DD'),
time: date_fns_1.default.format(now, 'HH-mm-ss'),
size,

@@ -192,3 +193,3 @@ width,

}
const screenshot = yield capture_website_1.default.buffer(uri, finalOptions);
const screenshot = yield capture_website_1.default.buffer(url, finalOptions);
screenshot.filename = filename;

@@ -195,0 +196,0 @@ return screenshot;

{
"name": "pageres",
"version": "5.0.2",
"version": "5.1.0",
"description": "Capture website screenshots",

@@ -58,5 +58,5 @@ "license": "MIT",

"array-uniq": "^2.0.0",
"capture-website": "^0.1.2",
"easydate": "^2.0.0",
"filenamify": "^2.0.0",
"capture-website": "^0.3.0",
"date-fns": "^1.30.1",
"filenamify": "^3.0.0",
"filenamify-url": "^1.0.0",

@@ -69,9 +69,9 @@ "get-res": "^3.0.0",

"plur": "^3.0.1",
"unused-filename": "^1.0.0",
"unused-filename": "^2.0.0",
"viewport-list": "^5.0.1"
},
"devDependencies": {
"@sindresorhus/tsconfig": "^0.2.0",
"@sindresorhus/tsconfig": "^0.3.0",
"@types/image-size": "^0.7.0",
"@types/node": "^10.12.23",
"@types/node": "^11.11.4",
"@typescript-eslint/eslint-plugin": "^1.3.0",

@@ -82,3 +82,3 @@ "ava": "^1.2.0",

"del-cli": "^1.1.0",
"eslint-config-xo-typescript": "^0.7.0",
"eslint-config-xo-typescript": "^0.9.0",
"file-type": "^10.7.1",

@@ -96,3 +96,3 @@ "get-port": "^4.1.0",

},
"typings": "dist",
"types": "dist",
"ava": {

@@ -102,4 +102,3 @@ "babel": false,

"extensions": [
"ts",
"js"
"ts"
],

@@ -106,0 +105,0 @@ "require": [

@@ -103,4 +103,4 @@ # ![pageres](media/promo.png)

- `crop`: Outputs `-cropped` when the crop option is true
- `date`: The current date (Y-M-d), eg. 2015-05-18
- `time`: The current time (h-m-s), eg. 21-15-11
- `date`: The current date (YYYY-MM-DD), eg. 2015-05-18
- `time`: The current time (HH-mm-ss), eg. 21-15-11

@@ -225,2 +225,7 @@ ##### incrementalName

## Related
- [capture-website](https://github.com/sindresorhus/capture-website) - A different take on screenshotting websites
## Team

@@ -227,0 +232,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc