Skip to content

Commit

Permalink
core(config): move duplicated-javascript and legacy-javascript to def…
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Jul 15, 2020
1 parent e1a0bf0 commit c159869
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 13 deletions.
16 changes: 16 additions & 0 deletions lighthouse-cli/test/cli/__snapshots__/index-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ Object {
Object {
"path": "byte-efficiency/efficient-animated-content",
},
Object {
"path": "byte-efficiency/duplicated-javascript",
},
Object {
"path": "byte-efficiency/legacy-javascript",
},
Object {
"path": "dobetterweb/appcache-manifest",
},
Expand Down Expand Up @@ -887,6 +893,16 @@ Object {
"id": "efficient-animated-content",
"weight": 0,
},
Object {
"group": "load-opportunities",
"id": "duplicated-javascript",
"weight": 0,
},
Object {
"group": "load-opportunities",
"id": "legacy-javascript",
"weight": 0,
},
Object {
"group": "diagnostics",
"id": "total-byte-weight",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ module.exports = {
'legacy-javascript',
],
},
// Not in default yet.
audits: ['byte-efficiency/legacy-javascript'],
};
4 changes: 4 additions & 0 deletions lighthouse-core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ const defaultConfig = {
'byte-efficiency/uses-text-compression',
'byte-efficiency/uses-responsive-images',
'byte-efficiency/efficient-animated-content',
'byte-efficiency/duplicated-javascript',
'byte-efficiency/legacy-javascript',
'dobetterweb/appcache-manifest',
'dobetterweb/doctype',
'dobetterweb/charset',
Expand Down Expand Up @@ -443,6 +445,8 @@ const defaultConfig = {
{id: 'redirects', weight: 0, group: 'load-opportunities'},
{id: 'uses-rel-preload', weight: 0, group: 'load-opportunities'},
{id: 'efficient-animated-content', weight: 0, group: 'load-opportunities'},
{id: 'duplicated-javascript', weight: 0, group: 'load-opportunities'},
{id: 'legacy-javascript', weight: 0, group: 'load-opportunities'},
{id: 'total-byte-weight', weight: 0, group: 'diagnostics'},
{id: 'uses-long-cache-ttl', weight: 0, group: 'diagnostics'},
{id: 'dom-size', weight: 0, group: 'diagnostics'},
Expand Down
10 changes: 0 additions & 10 deletions lighthouse-core/config/experimental-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,8 @@
const config = {
extends: 'lighthouse:default',
audits: [
'byte-efficiency/duplicated-javascript',
'byte-efficiency/legacy-javascript',
],
categories: {
// @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
// config is awkward - easier to omit the property here. Will defer to default config.
'performance': {
auditRefs: [
{id: 'duplicated-javascript', weight: 0, group: 'load-opportunities'},
{id: 'legacy-javascript', weight: 0, group: 'load-opportunities'},
],
},
},
};

Expand Down
144 changes: 143 additions & 1 deletion lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3051,6 +3051,94 @@
"overallSavingsBytes": 0
}
},
"duplicated-javascript": {
"id": "duplicated-javascript",
"title": "Remove duplicate modules in JavaScript bundles",
"description": "Remove large, duplicate JavaScript modules from bundles to reduce unnecessary bytes consumed by network activity. ",
"score": 1,
"scoreDisplayMode": "numeric",
"numericValue": 0,
"numericUnit": "millisecond",
"displayValue": "",
"details": {
"type": "opportunity",
"headings": [],
"items": [],
"overallSavingsMs": 0,
"overallSavingsBytes": 0
}
},
"legacy-javascript": {
"id": "legacy-javascript",
"title": "Avoid serving legacy JavaScript to modern browsers",
"description": "Polyfills and transforms enable legacy browsers to use new JavaScript features. However, many aren't necessary for modern browsers. For your bundled JavaScript, adopt a modern script deployment strategy using module/nomodule feature detection to reduce the amount of code shipped to modern browsers, while retaining support for legacy browsers. [Learn More](https://philipwalton.com/articles/deploying-es2015-code-in-production-today/)",
"score": 1,
"scoreDisplayMode": "numeric",
"numericValue": 0,
"numericUnit": "millisecond",
"displayValue": "Potential savings of 21 KiB",
"details": {
"type": "opportunity",
"headings": [
{
"key": "url",
"valueType": "url",
"subItemsHeading": {
"key": "location",
"valueType": "source-location"
},
"label": "URL"
},
{
"key": null,
"valueType": "code",
"subItemsHeading": {
"key": "signal"
},
"label": ""
},
{
"key": "wastedBytes",
"valueType": "bytes",
"label": "Potential Savings"
}
],
"items": [
{
"url": "http://localhost:10200/zone.js",
"wastedBytes": 21205,
"subItems": {
"type": "subitems",
"items": [
{
"signal": "Object.defineProperty",
"location": {
"type": "source-location",
"url": "http://localhost:10200/zone.js",
"line": 1290,
"column": 4,
"urlProvider": "network"
}
},
{
"signal": "Object.defineProperties",
"location": {
"type": "source-location",
"url": "http://localhost:10200/zone.js",
"line": 1300,
"column": 4,
"urlProvider": "network"
}
}
]
},
"totalBytes": 0
}
],
"overallSavingsMs": 0,
"overallSavingsBytes": 21205
}
},
"appcache-manifest": {
"id": "appcache-manifest",
"title": "Uses Application Cache",
Expand Down Expand Up @@ -4012,6 +4100,16 @@
"weight": 0,
"group": "load-opportunities"
},
{
"id": "duplicated-javascript",
"weight": 0,
"group": "load-opportunities"
},
{
"id": "legacy-javascript",
"weight": 0,
"group": "load-opportunities"
},
{
"id": "total-byte-weight",
"weight": 0,
Expand Down Expand Up @@ -5688,6 +5786,30 @@
"duration": 100,
"entryType": "measure"
},
{
"startTime": 0,
"name": "lh:audit:duplicated-javascript",
"duration": 100,
"entryType": "measure"
},
{
"startTime": 0,
"name": "lh:computed:ModuleDuplication",
"duration": 100,
"entryType": "measure"
},
{
"startTime": 0,
"name": "lh:computed:JSBundles",
"duration": 100,
"entryType": "measure"
},
{
"startTime": 0,
"name": "lh:audit:legacy-javascript",
"duration": 100,
"entryType": "measure"
},
{
"startTime": 0,
"name": "lh:audit:appcache-manifest",
Expand Down Expand Up @@ -6105,6 +6227,7 @@
"audits[unminified-javascript].details.headings[0].label",
"audits[uses-webp-images].details.headings[1].label",
"audits[uses-text-compression].details.headings[0].label",
"audits[legacy-javascript].details.headings[0].label",
"audits[geolocation-on-start].details.headings[0].text",
"audits[no-document-write].details.headings[0].text",
"audits[notification-on-start].details.headings[0].text",
Expand Down Expand Up @@ -6833,7 +6956,8 @@
"audits[render-blocking-resources].details.headings[2].label",
"audits[unminified-javascript].details.headings[2].label",
"audits[uses-webp-images].details.headings[3].label",
"audits[uses-text-compression].details.headings[2].label"
"audits[uses-text-compression].details.headings[2].label",
"audits[legacy-javascript].details.headings[2].label"
],
"lighthouse-core/audits/byte-efficiency/unminified-css.js | title": [
"audits[unminified-css].title"
Expand Down Expand Up @@ -6865,6 +6989,12 @@
"wastedBytes": 64646
},
"path": "audits[uses-text-compression].displayValue"
},
{
"values": {
"wastedBytes": 21205
},
"path": "audits[legacy-javascript].displayValue"
}
],
"lighthouse-core/audits/byte-efficiency/unused-css-rules.js | title": [
Expand Down Expand Up @@ -6912,6 +7042,18 @@
"lighthouse-core/audits/byte-efficiency/efficient-animated-content.js | description": [
"audits[efficient-animated-content].description"
],
"lighthouse-core/audits/byte-efficiency/duplicated-javascript.js | title": [
"audits[duplicated-javascript].title"
],
"lighthouse-core/audits/byte-efficiency/duplicated-javascript.js | description": [
"audits[duplicated-javascript].description"
],
"lighthouse-core/audits/byte-efficiency/legacy-javascript.js | title": [
"audits[legacy-javascript].title"
],
"lighthouse-core/audits/byte-efficiency/legacy-javascript.js | description": [
"audits[legacy-javascript].description"
],
"lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": [
"audits[appcache-manifest].title"
],
Expand Down

0 comments on commit c159869

Please sign in to comment.