0.2.5 • Published 3 years ago

lighthouse-plugin-md5 v0.2.5

Weekly downloads
25
License
MIT
Repository
github
Last release
3 years ago

Lighthouse Plugin: MD5

NPM Github Workflow Status Codecov

A plugin to help you generate network requests content md5 and set in resource-content-md5 audit.

Usage

Installation

npm i lighthouse-plugin-md5

or use yarn

yarn add lighthouse-plugin-md5

Lighthouse Configuration

When programmatically use lighthouse, you can follow below

Add plugins and configFlags.configPath in Configuration

// make configFixturePath to your project `<rootDir>/node_modules`
// it might be not clean but is a better workaround for standalone lighthouse plugin from public registry
const configFixturePath = resolve('node_modules');

const configJson = {
  extends: 'lighthouse:default',
  plugins: ['lighthouse-plugin-md5'],
  passes: [
    {
      passName: 'defaultPass',
      gatherers: [{ path: 'lighthouse-plugin-md5/lib/gatherers/resource-content-md5' }]
    }
  ]
};
const configPathFlags = { configPath: configFixturePath };

const result = await lighthouse(url, configPathFlags, configJson);

You can see a new audits with id resource-content-md5 in LHR

like below

{
  "audits": {
    "resource-content-md5": {
      "id": "resource-content-md5",
      "title": "Resource Content MD5",
      "description": "Resource Content with MD5 Validation",
      "score": 1,
      "scoreDisplayMode": "binary",
      "numericValue": 96,
      "details": {
        "type": "table",
        "headings": [
          { "key": "url", "itemType": "url", "text": "URL" },
          { "key": "md5", "itemType": "string", "text": "MD5" }
        ],
        "items": [
          {
            "url": "https://example.com/somepic.png",
            "md5": "1c9f929b054c91b4d45c376eebab291a"
          },
          {
            "url": "https://example.com/somejs.js",
            "md5": "dd8a239825fde9dcd882c4f3c8002b55"
          }
        ]
      }
    }
  }
}
0.2.5

3 years ago

0.2.4

4 years ago

0.2.1

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago