Socket
Socket
Sign inDemoInstall

capture-website

Package Overview
Dependencies
58
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.8.2 to 1.0.0

13

index.d.ts
/// <reference lib="dom"/>
/// <reference types="puppeteer"/>
import {SetCookie, LaunchOptions, Page, Browser} from 'puppeteer';

@@ -150,3 +149,3 @@

*/
readonly scrollToElement?: string | captureWebsite.ScrollToElementOptions
readonly scrollToElement?: string | ScrollToElementOptions;

@@ -205,3 +204,3 @@ /**

*/
readonly cookies?: (string | SetCookie)[];
readonly cookies?: Array<string | SetCookie>;

@@ -282,7 +281,7 @@ /**

*/
file(
file: (
input: string,
outputFilePath: string,
options?: captureWebsite.FileOptions
): Promise<void>;
) => Promise<void>;

@@ -295,3 +294,3 @@ /**

*/
buffer(input: string, options?: captureWebsite.Options): Promise<Buffer>;
buffer: (input: string, options?: captureWebsite.Options) => Promise<Buffer>;

@@ -304,5 +303,5 @@ /**

*/
base64(input: string, options?: captureWebsite.Options): Promise<string>;
base64: (input: string, options?: captureWebsite.Options) => Promise<string>;
};
export = captureWebsite;

@@ -7,3 +7,3 @@ /* global document */

const puppeteer = require('puppeteer');
const devices = require('puppeteer/DeviceDescriptors');
const {devicesMap} = require('puppeteer/DeviceDescriptors');
const toughCookie = require('tough-cookie');

@@ -15,8 +15,2 @@

const removeElements = elements => {
for (const element of elements) {
element.style.display = 'none';
}
};
const scrollToElement = (element, options) => {

@@ -115,3 +109,3 @@ const isOverflown = element => {

jar.setCookieSync(cookie, url);
const ret = jar.serializeSync().cookies[0];
const returnValue = jar.serializeSync().cookies[0];

@@ -122,10 +116,10 @@ // Use this instead of the above when the following issue is fixed:

ret.name = ret.key;
delete ret.key;
returnValue.name = returnValue.key;
delete returnValue.key;
if (ret.expires) {
ret.expires = Math.floor(new Date(ret.expires) / 1000);
if (returnValue.expires) {
returnValue.expires = Math.floor(new Date(returnValue.expires) / 1000);
}
return ret;
return returnValue;
};

@@ -229,7 +223,7 @@

if (options.emulateDevice) {
if (!(options.emulateDevice in devices)) {
if (!(options.emulateDevice in devicesMap)) {
throw new Error(`The device name \`${options.emulateDevice}\` is not supported`);
}
await page.emulate(devices[options.emulateDevice]);
await page.emulate(devicesMap[options.emulateDevice]);
}

@@ -253,3 +247,3 @@

await page.addStyleTag({
content: `${options.hideElements.join(', ')} { visibility: hidden; }`
content: `${options.hideElements.join(', ')} { visibility: hidden !important; }`
});

@@ -259,3 +253,5 @@ }

if (options.removeElements) {
await Promise.all(options.removeElements.map(selector => page.$$eval(selector, removeElements)));
await page.addStyleTag({
content: `${options.removeElements.join(' ')} { display: none !important; }`
});
}

@@ -354,3 +350,3 @@

module.exports.devices = Object.values(devices).map(device => device.name);
module.exports.devices = Object.values(devicesMap).map(device => device.name);

@@ -357,0 +353,0 @@ if (process.env.NODE_ENV === 'test') {

{
"name": "capture-website",
"version": "0.8.2",
"version": "1.0.0",
"description": "Capture screenshots of websites",
"license": "MIT",
"repository": "sindresorhus/capture-website",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},

@@ -39,7 +40,7 @@ "scripts": {

"file-url": "^3.0.0",
"puppeteer": "^2.0.0",
"tough-cookie": "^3.0.1"
"puppeteer": "^3.0.4",
"tough-cookie": "^4.0.0"
},
"devDependencies": {
"@types/puppeteer": "^1.20.2",
"@types/puppeteer": "^2.0.1",
"ava": "^2.0.0",

@@ -51,8 +52,13 @@ "create-test-server": "^3.0.1",

"is-png": "^2.0.0",
"pify": "^4.0.1",
"png-js": "^0.1.1",
"tempy": "^0.3.0",
"tsd": "^0.10.0",
"xo": "^0.25.3"
"pify": "^5.0.0",
"png-js": "^1.0.0",
"tempy": "^0.5.0",
"tsd": "^0.11.0",
"xo": "^0.30.0"
},
"xo": {
"rules": {
"@typescript-eslint/prefer-readonly-parameter-types": "off"
}
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc