Lighthouse

Run Lighthouse on demand

lighthouse.js
const mql = require('@microlink/mql')

const lighthouse = async (url, opts) => {
  const { data } = await mql(url, {
    meta: false,
    insights: {
      lighthouse: {
        device: 'mobile',
        onlyCategories: [
          'performance',
          'best-practices',
          'accessibility',
          'seo',
          'pwa',
        ],
      },
      technologies: false,
    },
    ...opts,
  })

  return data.insights.lighthouse
}

const result = await lighthouse('https://example.com')

mql.render(result)