Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

puppeteer-extra

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer-extra - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

index.test.js

31

index.js

@@ -105,4 +105,5 @@ 'use strict'

const browser = await Puppeteer.launch(options)
browser.newPage = this._delayAsync(10, browser.newPage, browser)
await this.callPlugins('_bindBrowserEvents', browser, options)
await this.callPlugins('_bindBrowserEvents', browser, options)
return browser

@@ -112,2 +113,30 @@ }

/**
* Delays an arbitrary async function to resolve by a specified number of milliseconds.
*
* Unfortunately we currently need to add a minimal delay to methods that can create
* a new target, as there's a small chance that event listeners are not ready
* yet when the first target is created. :-/
*
* Puppeteer issues:
* https://github.com/GoogleChrome/puppeteer/issues/386#issuecomment-343059315
* https://github.com/GoogleChrome/puppeteer/issues/1378#issue-273733905
*
* @todo support browser.createIncognitoBrowserContext() / context.newPage()
*
* @param {Number} timeout - Delay in milliseconds
* @param {Function} method - The async method to use
* @param {any} context - the this to use
* @return {Promise}
* @private
*/
_delayAsync (timeout = 10, method, context = this) {
const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
return async () => {
const result = await method.apply(context, arguments)
await delay(timeout)
return result
}
}
/**
* Get all registered plugins.

@@ -114,0 +143,0 @@ *

4

package.json
{
"name": "puppeteer-extra",
"version": "2.0.1",
"version": "2.0.2",
"description": "Teach puppeteer new tricks through plugins.",

@@ -11,3 +11,3 @@ "main": "index.js",

"docs": "update-markdown-jsdoc",
"test": "standard"
"test": "ava -v && standard"
},

@@ -14,0 +14,0 @@ "engines": {

# puppeteer-extra
[![npm](https://img.shields.io/npm/v/puppeteer-extra.svg?style=flat-square)](https://www.npmjs.com/package/puppeteer-extra)
[![npm](https://img.shields.io/npm/dt/puppeteer-extra.svg?style=flat-square)](https://www.npmjs.com/package/puppeteer-extra)
[![npm](https://img.shields.io/npm/l/puppeteer-extra.svg?style=flat-square)](https://www.npmjs.com/package/puppeteer-extra)
[![npm](https://img.shields.io/npm/v/puppeteer-extra.svg)](https://www.npmjs.com/package/puppeteer-extra)
[![npm](https://img.shields.io/npm/dt/puppeteer-extra.svg)](https://www.npmjs.com/package/puppeteer-extra)
[![npm](https://img.shields.io/npm/l/puppeteer-extra.svg)](https://www.npmjs.com/package/puppeteer-extra)
`puppeteer-extra` is a drop-in replacement for [`puppeteer`](https://github.com/GoogleChrome/puppeteer) that enables plugins through a clean interface.
[![extra](https://i.imgur.com/2ZjXBe5.jpg)](https://github.com/berstend/puppeteer-extra)
It's not a puppeteer fork but augments your existing `puppeteer` module with a modular and lightweight plugin framework.
> A light-weight wrapper around [`puppeteer`](https://github.com/GoogleChrome/puppeteer) that enables [plugins](#plugins) through a clean interface.
### Install
## Installation

@@ -27,3 +27,3 @@ ```bash

### Usage
## Quickstart

@@ -67,9 +67,9 @@ ```es6

### Contributing
## Contributing
PRs and new plugins are welcome! The plugin API for `puppeteer-extra` is clean and fun to use. Have a look the [`PuppeteerExtraPlugin`](/packages/puppeteer-extra-plugin) base class documentation to get going and check out the [existing plugins](/packages/) for reference.
PRs and new plugins are welcome! :tada: The plugin API for `puppeteer-extra` is clean and fun to use. Have a look the [PuppeteerExtraPlugin](/packages/puppeteer-extra-plugin) base class documentation to get going and check out the [existing plugins](./packages/) (minimal example is the [anonymize-ua](/packages/puppeteer-extra-plugin-anonymize-ua/index.js) plugin) for reference.
We use a [monorepo](/), the [`standard`](https://standardjs.com/) coding style and [JSDoc](http://usejsdoc.org/about-getting-started.html) heavily to [auto-generate](https://github.com/transitive-bullshit/update-markdown-jsdoc) markdown documentation based on code. :-)
We use a [monorepo](/) powered by [Lerna](https://github.com/lerna/lerna#--use-workspaces) (and yarn workspaces), [ava](https://github.com/avajs/ava) for testing, the [standard](https://standardjs.com/) style for linting and [JSDoc](http://usejsdoc.org/about-getting-started.html) heavily to [auto-generate](https://github.com/transitive-bullshit/update-markdown-jsdoc) markdown [documentation](https://github.com/documentationjs/documentation) based on code. :-)
#### Kudos
### Kudos

@@ -97,3 +97,3 @@ - Thanks to [skyiea](https://github.com/skyiea) for [this PR](https://github.com/GoogleChrome/puppeteer/pull/1806) that started the project idea.

### [PuppeteerExtra](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L43-L328)
### [PuppeteerExtra](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L43-L357)

@@ -126,3 +126,3 @@ Modular plugin framework to teach `puppeteer` new tricks.

#### [use](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L63-L79)
#### [use](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L63-L79)

@@ -146,3 +146,3 @@ Outside interface to register plugins.

#### [launch](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L94-L108)
#### [launch](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L94-L109)

@@ -162,3 +162,3 @@ Main launch method.

#### [plugins](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L115-L115)
#### [plugins](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L144-L144)

@@ -171,3 +171,3 @@ Get all registered plugins.

#### [getPluginData](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L137-L142)
#### [getPluginData](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L166-L171)

@@ -189,3 +189,3 @@ - **See: puppeteer-extra-plugin/data**

#### [connect](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L297-L299)
#### [connect](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L326-L328)

@@ -200,3 +200,3 @@ Regular Puppeteer method that is being passed through.

#### [executablePath](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L306-L308)
#### [executablePath](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L335-L337)

@@ -209,3 +209,3 @@ Regular Puppeteer method that is being passed through.

#### [defaultArgs](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L315-L317)
#### [defaultArgs](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L344-L346)

@@ -218,3 +218,3 @@ Regular Puppeteer method that is being passed through.

#### [createBrowserFetcher](https://github.com/berstend/puppeteer-extra/blob/39bb3948016ab4afc7e6f31459828035c8e8c65c/packages/puppeteer-extra/index.js#L325-L327)
#### [createBrowserFetcher](https://github.com/berstend/puppeteer-extra/blob/139d9ecf97a46dc383adede213e1a4c707160dca/packages/puppeteer-extra/index.js#L354-L356)

@@ -221,0 +221,0 @@ Regular Puppeteer method that is being passed through.

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