playwright-lighthouse
Advanced tools
Comparing version 2.2.2 to 3.0.0
@@ -1,2 +0,1 @@ | ||
const { playAudit } = require('./src/audit'); | ||
module.exports = { playAudit }; | ||
export { playAudit } from './src/audit.js'; |
{ | ||
"name": "playwright-lighthouse", | ||
"version": "2.2.2", | ||
"version": "3.0.0", | ||
"description": "Playwright Lighthouse Audit", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
@@ -17,3 +18,3 @@ "test": "mocha --parallel --timeout 30000", | ||
"engines": { | ||
"node": ">=10.x" | ||
"node": ">=16.x" | ||
}, | ||
@@ -38,3 +39,3 @@ "keywords": [ | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"lighthouse": "^9.5.0", | ||
"lighthouse": "^10.0.1", | ||
"mocha": "9.2.2", | ||
@@ -41,0 +42,0 @@ "playwright-core": "1.19.2", |
@@ -32,4 +32,4 @@ ## Lighthouse Playwright - NPM Package | ||
```js | ||
const { playAudit } = require('playwright-lighthouse'); | ||
const playwright = require('playwright'); | ||
import { playAudit } from 'playwright-lighthouse' | ||
import playwright from 'playwright' | ||
@@ -61,4 +61,4 @@ describe('audit example', () => { | ||
```javascript | ||
const { playAudit } = require('playwright-lighthouse'); | ||
const playwright = require('playwright'); | ||
import { playAudit } from 'playwright-lighthouse' | ||
import playwright from 'playwright' | ||
@@ -165,5 +165,5 @@ describe('audit example', () => { | ||
```js | ||
const os = require('os'); | ||
const { playAudit } = require('playwright-lighthouse'); | ||
const { chromium } = require('playwright'); | ||
import os from 'os' | ||
import { playAudit } from 'playwright-lighthouse' | ||
import { chromium } from 'playwright' | ||
@@ -170,0 +170,0 @@ describe('audit example', () => { |
@@ -1,2 +0,2 @@ | ||
const { lighthouse } = require('./task'); | ||
import { lighthouse } from './task.js'; | ||
@@ -23,3 +23,3 @@ const defaultThresholds = { | ||
let playAudit = async function (auditConfig = {}) { | ||
export const playAudit = async function (auditConfig = {}) { | ||
if (!auditConfig.port || (!auditConfig.page && !auditConfig.url)) { | ||
@@ -34,7 +34,7 @@ throw new Error( | ||
? new Proxy({}, { get: () => () => {} }) | ||
: require('chalk'); | ||
: await import('chalk').then((m) => m.default); | ||
const url = auditConfig.url || auditConfig.page.url(); | ||
if (auditConfig.page) { | ||
const uaParser = require('ua-parser-js'); | ||
const { default: uaParser } = await import('ua-parser-js'); | ||
@@ -109,3 +109,1 @@ // eslint-disable-next-line no-undef | ||
}; | ||
exports.playAudit = playAudit; |
@@ -1,4 +0,4 @@ | ||
const fs = require('fs/promises'); | ||
const lighthouseLib = require('lighthouse'); | ||
const ReportGenerator = require('lighthouse/report/generator/report-generator'); | ||
import fs from 'fs/promises'; | ||
import lighthouseLib from 'lighthouse'; | ||
import { ReportGenerator } from 'lighthouse/report/generator/report-generator.js'; | ||
@@ -37,3 +37,3 @@ const compare = (thresholds, newValue) => { | ||
exports.lighthouse = async ({ | ||
export const lighthouse = async ({ | ||
url, | ||
@@ -40,0 +40,0 @@ thresholds, |
Yes
21418
221