Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/harAnalyzer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { JSDOM } from 'jsdom';
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { ESLint } from 'eslint';
Expand All @@ -23,6 +24,10 @@ export class HarAnalyzer {

const libFolder = fileURLToPath(new URL('..', import.meta.url));
this.pluginFolder = path.resolve(libFolder, '..');
const packagePath = path.resolve(libFolder, 'package.json');
this.package = JSON.parse(readFileSync(packagePath, 'utf8'));
this.dependencies = this.package.dependencies;
this.version = this.package.version;
}
transform2SimplifiedData(harData, url) {
const data = {
Expand Down Expand Up @@ -225,6 +230,8 @@ export class HarAnalyzer {
this.groups[group]['knowledgeData'].push(knowledgeData);

return {
'version': this.version,
'dependencies': this.dependencies,
'url': url,
'analyzedData': analyzedData,
'knowledgeData': knowledgeData
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"jsdom": "26.0.0",
"eslint": "9.24.0",
"globals": "16.0.0",
"@sitespeed.io/log": "0.2.6",
"@sitespeed.io/plugin": "1.0.0"
},
"scripts": {
Expand Down
12 changes: 10 additions & 2 deletions pug/index.pug
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
- let pluginData = pageInfo.data['webperf-plugin-javascript'].run ? pageInfo.data['webperf-plugin-javascript'].run : pageInfo.data['webperf-plugin-javascript'].pageSummary

h2 Javascript
p This plugin is used to check your Javascript code for errors and enforce coding standards and security. It can help you catch common mistakes, improve code quality, and ensure consistency across your scripts.
br
span Using plugin-javascript v#{pluginData.version}
span with dependencies:
each version, name in pluginData.dependencies
span #{name} v#{version},

if pluginData.knowledgeData && pluginData.knowledgeData.issues && Object.keys(pluginData.knowledgeData.issues).length > 0
- let issueSets = pluginData.knowledgeData.issues;
- let issues = Object.values(issueSets);
Expand All @@ -11,7 +19,7 @@ if pluginData.knowledgeData && pluginData.knowledgeData.issues && Object.keys(pl
- return b.subIssues.length - a.subIssues.length;
- });

h1 Issues
h3 Issues
table
thead
tr
Expand Down Expand Up @@ -40,7 +48,7 @@ if pluginData.knowledgeData && pluginData.knowledgeData.issues && Object.keys(pl

// Add tables for each rule
each value in sortedIssues
h2(id=`rule-${value.rule}`)= `${value.rule}`
h4(id=`rule-${value.rule}`)= `${value.rule}`
p
strong Category:
= value.category
Expand Down