puppeteer-extra-plugin
Advanced tools
Comparing version 3.1.9 to 3.2.0
/*! | ||
* puppeteer-extra-plugin v3.1.8 by berstend | ||
* puppeteer-extra-plugin v3.1.9 by berstend | ||
* https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin | ||
@@ -422,3 +422,3 @@ * @license MIT | ||
const pluginNames = new Set(plugins.map((p) => p.name)); | ||
const missing = new Set(Array.from(this.dependencies.values()).filter((x) => !pluginNames.has(x))); | ||
const missing = new Set(Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x))); | ||
return missing; | ||
@@ -490,6 +490,15 @@ } | ||
if (target.type() === 'page') { | ||
const page = await target.page(); | ||
if (this.onPageCreated) { | ||
await this.onPageCreated(page); | ||
try { | ||
const page = await target.page(); | ||
if (!page) { | ||
return; | ||
} | ||
const validPage = 'isClosed' in page && !page.isClosed(); | ||
if (this.onPageCreated && validPage) { | ||
await this.onPageCreated(page); | ||
} | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
@@ -496,0 +505,0 @@ } |
import { Debugger } from 'debug'; | ||
import * as Puppeteer from 'puppeteer'; | ||
import * as Puppeteer from './puppeteer'; | ||
export interface PluginOptions { | ||
@@ -4,0 +4,0 @@ [key: string]: any; |
/*! | ||
* puppeteer-extra-plugin v3.1.8 by berstend | ||
* puppeteer-extra-plugin v3.1.9 by berstend | ||
* https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin | ||
@@ -416,3 +416,3 @@ * @license MIT | ||
const pluginNames = new Set(plugins.map((p) => p.name)); | ||
const missing = new Set(Array.from(this.dependencies.values()).filter((x) => !pluginNames.has(x))); | ||
const missing = new Set(Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x))); | ||
return missing; | ||
@@ -484,6 +484,15 @@ } | ||
if (target.type() === 'page') { | ||
const page = await target.page(); | ||
if (this.onPageCreated) { | ||
await this.onPageCreated(page); | ||
try { | ||
const page = await target.page(); | ||
if (!page) { | ||
return; | ||
} | ||
const validPage = 'isClosed' in page && !page.isClosed(); | ||
if (this.onPageCreated && validPage) { | ||
await this.onPageCreated(page); | ||
} | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
@@ -490,0 +499,0 @@ } |
@@ -53,3 +53,3 @@ "use strict"; | ||
constructor(opts) { | ||
this._debugBase = debug_1.default(`puppeteer-extra-plugin:base:${this.name}`); | ||
this._debugBase = (0, debug_1.default)(`puppeteer-extra-plugin:base:${this.name}`); | ||
this._childClassMembers = []; | ||
@@ -207,3 +207,3 @@ this._opts = merge(this.defaults, opts || {}); | ||
get debug() { | ||
return debug_1.default(`puppeteer-extra-plugin:${this.name}`); | ||
return (0, debug_1.default)(`puppeteer-extra-plugin:${this.name}`); | ||
} | ||
@@ -418,3 +418,3 @@ /** | ||
const pluginNames = new Set(plugins.map((p) => p.name)); | ||
const missing = new Set(Array.from(this.dependencies.values()).filter((x) => !pluginNames.has(x))); | ||
const missing = new Set(Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x))); | ||
return missing; | ||
@@ -486,6 +486,15 @@ } | ||
if (target.type() === 'page') { | ||
const page = await target.page(); | ||
if (this.onPageCreated) { | ||
await this.onPageCreated(page); | ||
try { | ||
const page = await target.page(); | ||
if (!page) { | ||
return; | ||
} | ||
const validPage = 'isClosed' in page && !page.isClosed(); | ||
if (this.onPageCreated && validPage) { | ||
await this.onPageCreated(page); | ||
} | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
@@ -492,0 +501,0 @@ } |
@@ -8,6 +8,6 @@ "use strict"; | ||
const _1 = require("."); | ||
ava_1.default('is a function', async (t) => { | ||
(0, ava_1.default)('is a function', async (t) => { | ||
t.is(typeof _1.PuppeteerExtraPlugin, 'function'); | ||
}); | ||
ava_1.default('will throw without a name', async (t) => { | ||
(0, ava_1.default)('will throw without a name', async (t) => { | ||
class Derived extends _1.PuppeteerExtraPlugin { | ||
@@ -18,3 +18,3 @@ } | ||
}); | ||
ava_1.default('should have the basic class members', async (t) => { | ||
(0, ava_1.default)('should have the basic class members', async (t) => { | ||
const pluginName = 'hello-world'; | ||
@@ -40,3 +40,3 @@ class Plugin extends _1.PuppeteerExtraPlugin { | ||
}); | ||
ava_1.default('should have the public class members', async (t) => { | ||
(0, ava_1.default)('should have the public class members', async (t) => { | ||
const pluginName = 'hello-world'; | ||
@@ -64,3 +64,3 @@ class Plugin extends _1.PuppeteerExtraPlugin { | ||
}); | ||
ava_1.default('should have the internal class members', async (t) => { | ||
(0, ava_1.default)('should have the internal class members', async (t) => { | ||
const pluginName = 'hello-world'; | ||
@@ -83,3 +83,3 @@ class Plugin extends _1.PuppeteerExtraPlugin { | ||
}); | ||
ava_1.default('should merge opts with defaults automatically', async (t) => { | ||
(0, ava_1.default)('should merge opts with defaults automatically', async (t) => { | ||
const pluginName = 'hello-world'; | ||
@@ -106,3 +106,3 @@ const pluginDefaults = { foo: 'bar', foo2: 'bar2', extra1: 123 }; | ||
}); | ||
ava_1.default('should have opts when defaults is not defined', async (t) => { | ||
(0, ava_1.default)('should have opts when defaults is not defined', async (t) => { | ||
const pluginName = 'hello-world'; | ||
@@ -109,0 +109,0 @@ const userOpts = { foo2: 'bob', extra2: 666 }; |
{ | ||
"name": "puppeteer-extra-plugin", | ||
"version": "3.1.9", | ||
"version": "3.2.0", | ||
"description": "Base class for puppeteer-extra plugins.", | ||
@@ -46,8 +46,8 @@ "main": "dist/index.cjs.js", | ||
"devDependencies": { | ||
"@types/node": "^13.1.4", | ||
"@types/puppeteer": "5.4.3", | ||
"@types/node": "14.14.34", | ||
"@types/puppeteer": "*", | ||
"ava": "2.4.0", | ||
"documentation-markdown-themes": "^12.1.5", | ||
"npm-run-all": "^4.1.5", | ||
"puppeteer": "^2.0.0", | ||
"puppeteer": "9", | ||
"rimraf": "^3.0.0", | ||
@@ -63,3 +63,3 @@ "rollup": "^1.27.5", | ||
"tslint-config-standard": "^9.0.0", | ||
"typescript": "^3.7.4" | ||
"typescript": "4.4.3" | ||
}, | ||
@@ -74,3 +74,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "adcc26325c9a01febcd152e5fb79555b29187a5f" | ||
"gitHead": "008c114b7f056cb1993ea27f45bb837058f62646" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147458
16
2130