Documentation
¶
Overview ¶
Package lighthouse provides Lighthouse audit runners and score-to-issue conversion.
Index ¶
Constants ¶
View Source
const ( // PerfCriticalThreshold is the performance score below which an issue is critical. PerfCriticalThreshold = 50 // PerfWarningThreshold is the performance score below which an issue is a warning. PerfWarningThreshold = 90 // AccessibilityWarningThreshold is the accessibility score below which an issue is a warning. AccessibilityWarningThreshold = 90 // SEOWarningThreshold is the SEO score below which an issue is a warning. SEOWarningThreshold = 90 )
Score thresholds for converting Lighthouse scores to issues.
View Source
const ( CheckPerformance = "lighthouse/performance" CheckAccessibility = "lighthouse/accessibility" CheckSEO = "lighthouse/seo" )
Check name constants.
View Source
const ( // PSIEndpoint is the PageSpeed Insights API URL. PSIEndpoint = "https://www.googleapis.com/pagespeedonline/v5/runPagespeed" // PSITimeout is the per-request timeout for PSI calls. PSITimeout = 60 * time.Second )
PSI API constants.
Variables ¶
This section is empty.
Functions ¶
func ScoreToIssues ¶
func ScoreToIssues(result *model.LighthouseResult) []model.Issue
ScoreToIssues converts a LighthouseResult into issues based on score thresholds.
Types ¶
type BrowserlessClient ¶
type BrowserlessClient struct {
// contains filtered or unexported fields
}
BrowserlessClient runs Lighthouse audits via a browserless container.
func NewBrowserlessClient ¶
func NewBrowserlessClient(browserlessURL string, l logger.Logger) *BrowserlessClient
NewBrowserlessClient creates a new browserless client.
func (*BrowserlessClient) Run ¶
func (c *BrowserlessClient) Run(ctx context.Context, targetURL string) (*model.LighthouseResult, error)
Run executes a Lighthouse audit via browserless and returns the result.
type PSIClient ¶
type PSIClient struct {
// contains filtered or unexported fields
}
PSIClient calls the PageSpeed Insights API.
func NewPSIClient ¶
NewPSIClient creates a PSI client with appropriate rate limiting.
Click to show internal directories.
Click to hide internal directories.