Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: rename uses-webp-images to modern-image-formats #12535

Merged
merged 4 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions lighthouse-cli/test/cli/__snapshots__/index-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ Object {
"path": "byte-efficiency/unused-javascript",
},
Object {
"path": "byte-efficiency/uses-webp-images",
"path": "byte-efficiency/modern-image-formats",
},
Object {
"path": "byte-efficiency/uses-optimized-images",
Expand Down Expand Up @@ -976,7 +976,7 @@ Object {
},
Object {
"group": "load-opportunities",
"id": "uses-webp-images",
"id": "modern-image-formats",
"weight": 0,
},
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config = {
'network-requests',
'offscreen-images',
'uses-http2',
'uses-webp-images',
'modern-image-formats',
'uses-optimized-images',
'uses-text-compression',
'uses-responsive-images',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const expectations = [
],
},
},
'uses-webp-images': {
'modern-image-formats': {
details: {
overallSavingsBytes: '>60000',
items: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

const IGNORE_THRESHOLD_IN_BYTES = 8192;

class UsesWebPImages extends ByteEfficiencyAudit {
class NextGenImageFormats extends ByteEfficiencyAudit {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class NextGenImageFormats extends ByteEfficiencyAudit {
class ModernImageFormats extends ByteEfficiencyAudit {

and co

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, thanks :)

/**
* @return {LH.Audit.Meta}
*/
static get meta() {
return {
id: 'uses-webp-images',
id: 'modern-image-formats',
title: str_(UIStrings.title),
description: str_(UIStrings.description),
scoreDisplayMode: ByteEfficiencyAudit.SCORING_MODES.NUMERIC,
Expand Down Expand Up @@ -100,15 +100,18 @@ class UsesWebPImages extends ByteEfficiencyAudit {
// If naturalHeight or naturalWidth are falsy, information is not valid, skip.
if (!naturalWidth || !naturalHeight) continue;

webpSize = UsesWebPImages.estimateWebPSizeFromDimensions({naturalHeight, naturalWidth});
webpSize = NextGenImageFormats.estimateWebPSizeFromDimensions({
naturalHeight,
naturalWidth,
});
fromProtocol = false;
}

if (image.originalSize < webpSize + IGNORE_THRESHOLD_IN_BYTES) continue;

const url = URL.elideDataURI(image.url);
const isCrossOrigin = !URL.originsMatch(pageURL, image.url);
const webpSavings = UsesWebPImages.computeSavings({...image, webpSize: webpSize});
const webpSavings = NextGenImageFormats.computeSavings({...image, webpSize: webpSize});

items.push({
url,
Expand All @@ -135,5 +138,5 @@ class UsesWebPImages extends ByteEfficiencyAudit {
}
}

module.exports = UsesWebPImages;
module.exports = NextGenImageFormats;
module.exports.UIStrings = UIStrings;
4 changes: 2 additions & 2 deletions lighthouse-core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ const defaultConfig = {
'byte-efficiency/unminified-javascript',
'byte-efficiency/unused-css-rules',
'byte-efficiency/unused-javascript',
'byte-efficiency/uses-webp-images',
'byte-efficiency/modern-image-formats',
'byte-efficiency/uses-optimized-images',
'byte-efficiency/uses-text-compression',
'byte-efficiency/uses-responsive-images',
Expand Down Expand Up @@ -443,7 +443,7 @@ const defaultConfig = {
{id: 'unused-css-rules', weight: 0, group: 'load-opportunities'},
{id: 'unused-javascript', weight: 0, group: 'load-opportunities'},
{id: 'uses-optimized-images', weight: 0, group: 'load-opportunities'},
{id: 'uses-webp-images', weight: 0, group: 'load-opportunities'},
{id: 'modern-image-formats', weight: 0, group: 'load-opportunities'},
{id: 'uses-text-compression', weight: 0, group: 'load-opportunities'},
{id: 'uses-rel-preconnect', weight: 0, group: 'load-opportunities'},
{id: 'server-response-time', weight: 0, group: 'load-opportunities'},
Expand Down
39 changes: 0 additions & 39 deletions lighthouse-core/lib/i18n/locales/ar-XB.json

Large diffs are not rendered by default.

39 changes: 0 additions & 39 deletions lighthouse-core/lib/i18n/locales/ar.json

Large diffs are not rendered by default.

39 changes: 0 additions & 39 deletions lighthouse-core/lib/i18n/locales/bg.json

Large diffs are not rendered by default.

39 changes: 0 additions & 39 deletions lighthouse-core/lib/i18n/locales/ca.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading