Skip to content

Commit

Permalink
deps(lighthouse-stack-packs): upgrade to 1.7.0 (#13604)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Jan 28, 2022
1 parent 06aa3e2 commit eba2a4d
Show file tree
Hide file tree
Showing 7 changed files with 282 additions and 172 deletions.
5 changes: 5 additions & 0 deletions lighthouse-core/lib/stack-packs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const stackPacksToInclude = [
packId: 'wordpress',
requiredStacks: ['js:wordpress'],
},
// waiting for https://github.com/johnmichel/Library-Detector-for-Chrome/pull/193
// {
// packId: 'ezoic',
// requiredStacks: ['js:ezoic'],
// },
{
packId: 'drupal',
requiredStacks: ['js:drupal'],
Expand Down
339 changes: 180 additions & 159 deletions lighthouse-core/test/lib/stack-packs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,28 @@ describe('stack-packs lib', () => {
const result = lighthouseStackPacksDep
.filter(p => !stackPacksLib.stackPacksToInclude.find(p2 => p2.packId === p.id))
.map(p => p.id);
expect(result).toEqual([]);
// TODO: waiting for this
expect(result).toEqual(['ezoic']);
});
});

// These tests summarize the contents of the lighthouse-stack-packs package.
describe('lighthouse-stack-packs dep', () => {
it('snapshot packs', () => {
expect(lighthouseStackPacksDep.map((p) => p.id)).toMatchInlineSnapshot(`
Array [
"amp",
"angular",
"drupal",
"joomla",
"magento",
"next.js",
"octobercms",
"react",
"wordpress",
]
`);
Array [
"amp",
"angular",
"drupal",
"ezoic",
"joomla",
"magento",
"next.js",
"octobercms",
"react",
"wordpress",
]
`);
});

it('snapshot keys for each pack', () => {
Expand All @@ -50,152 +52,171 @@ describe('lighthouse-stack-packs dep', () => {
});
// Keys should only be added, not removed.
expect(result).toMatchInlineSnapshot(`
Array [
Object {
"id": "amp",
"keys": Array [
"modern-image-formats",
"offscreen-images",
"render-blocking-resources",
"unminified-css",
"efficient-animated-content",
"uses-responsive-images",
],
},
Object {
"id": "angular",
"keys": Array [
"total-byte-weight",
"unminified-warning",
"unused-javascript",
"uses-responsive-images",
"uses-rel-preload",
"dom-size",
],
},
Object {
"id": "drupal",
"keys": Array [
"unused-css-rules",
"unused-javascript",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-responsive-images",
"server-response-time",
"uses-rel-preconnect",
"font-display",
],
},
Object {
"id": "joomla",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"server-response-time",
],
},
Object {
"id": "magento",
"keys": Array [
"modern-image-formats",
"offscreen-images",
"disable-bundling",
"unminified-css",
"unminified-javascript",
"unused-javascript",
"uses-optimized-images",
"server-response-time",
"uses-rel-preconnect",
"uses-rel-preload",
"critical-request-chains",
"font-display",
],
},
Object {
"id": "next.js",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"render-blocking-resources",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"user-timings",
],
},
Object {
"id": "octobercms",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"server-response-time",
],
},
Object {
"id": "react",
"keys": Array [
"unminified-css",
"unminified-javascript",
"unused-javascript",
"server-response-time",
"redirects",
"user-timings",
"dom-size",
],
},
Object {
"id": "wordpress",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"server-response-time",
],
},
]
`);
Array [
Object {
"id": "amp",
"keys": Array [
"modern-image-formats",
"offscreen-images",
"render-blocking-resources",
"unminified-css",
"efficient-animated-content",
"uses-responsive-images",
],
},
Object {
"id": "angular",
"keys": Array [
"total-byte-weight",
"unminified-warning",
"unused-javascript",
"uses-responsive-images",
"uses-rel-preload",
"dom-size",
],
},
Object {
"id": "drupal",
"keys": Array [
"unused-css-rules",
"unused-javascript",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-responsive-images",
"server-response-time",
"uses-rel-preconnect",
"font-display",
],
},
Object {
"id": "ezoic",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-responsive-images",
"server-response-time",
"uses-rel-preconnect",
"uses-rel-preload",
"font-display",
],
},
Object {
"id": "joomla",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"server-response-time",
],
},
Object {
"id": "magento",
"keys": Array [
"modern-image-formats",
"offscreen-images",
"disable-bundling",
"unminified-css",
"unminified-javascript",
"unused-javascript",
"uses-optimized-images",
"server-response-time",
"uses-rel-preconnect",
"uses-rel-preload",
"critical-request-chains",
"font-display",
],
},
Object {
"id": "next.js",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"render-blocking-resources",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"user-timings",
"preload-lcp-image",
],
},
Object {
"id": "octobercms",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"server-response-time",
],
},
Object {
"id": "react",
"keys": Array [
"unminified-css",
"unminified-javascript",
"unused-javascript",
"server-response-time",
"redirects",
"user-timings",
"dom-size",
],
},
Object {
"id": "wordpress",
"keys": Array [
"unused-css-rules",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"server-response-time",
],
},
]
`);
});

// Keys for plugin audits are allowed in this package.
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -6828,15 +6828,15 @@
"title": "WordPress",
"iconDataURL": "data:image/svg+xml,%3Csvg viewBox=\"0 0 122.5 122.5\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Cg fill=\"%232f3439\"%3E%3Cpath d=\"M8.7 61.3c0 20.8 12.1 38.7 29.6 47.3l-25-68.7c-3 6.5-4.6 13.7-4.6 21.4zM96.7 58.6c0-6.5-2.3-11-4.3-14.5-2.7-4.3-5.2-8-5.2-12.3 0-4.8 3.7-9.3 8.9-9.3h.7a52.4 52.4 0 0 0-79.4 9.9h3.3c5.5 0 14-.6 14-.6 2.9-.2 3.2 4 .4 4.3 0 0-2.9.4-6 .5l19.1 57L59.7 59l-8.2-22.5c-2.8-.1-5.5-.5-5.5-.5-2.8-.1-2.5-4.5.3-4.3 0 0 8.7.7 13.9.7 5.5 0 14-.7 14-.7 2.8-.2 3.2 4 .3 4.3 0 0-2.8.4-6 .5l19 56.5 5.2-17.5c2.3-7.3 4-12.5 4-17z\"/%3E%3Cpath d=\"M62.2 65.9l-15.8 45.8a52.6 52.6 0 0 0 32.3-.9l-.4-.7zM107.4 36a49.6 49.6 0 0 1-3.6 24.2l-16.1 46.5A52.5 52.5 0 0 0 107.4 36z\"/%3E%3Cpath d=\"M61.3 0a61.3 61.3 0 1 0 .1 122.7A61.3 61.3 0 0 0 61.3 0zm0 119.7a58.5 58.5 0 1 1 .1-117 58.5 58.5 0 0 1-.1 117z\"/%3E%3C/g%3E%3C/svg%3E",
"descriptions": {
"unused-css-rules": "Consider reducing, or switching, the number of [WordPress plugins](https://wordpress.org/plugins/) loading unused CSS in your page. To identify plugins that are adding extraneous CSS, try running [code coverage](https://developers.google.com/web/updates/2017/04/devtools-release-notes#coverage) in Chrome DevTools. You can identify the theme/plugin responsible from the URL of the stylesheet. Look out for plugins that have many stylesheets in the list which have a lot of red in code coverage. A plugin should only enqueue a stylesheet if it is actually used on the page.",
"unused-css-rules": "Consider reducing, or switching, the number of [WordPress plugins](https://wordpress.org/plugins/) loading unused CSS in your page. To identify plugins that are adding extraneous CSS, try running [code coverage](https://developer.chrome.com/docs/devtools/coverage/) in Chrome DevTools. You can identify the theme/plugin responsible from the URL of the stylesheet. Look out for plugins that have many stylesheets in the list which have a lot of red in code coverage. A plugin should only enqueue a stylesheet if it is actually used on the page.",
"modern-image-formats": "Consider using a [plugin](https://wordpress.org/plugins/search/convert+webp/) or service that will automatically convert your uploaded images to the optimal formats.",
"offscreen-images": "Install a [lazy-load WordPress plugin](https://wordpress.org/plugins/search/lazy+load/) that provides the ability to defer any offscreen images, or switch to a theme that provides that functionality. Also consider using [the AMP plugin](https://wordpress.org/plugins/amp/).",
"total-byte-weight": "Consider showing excerpts in your post lists (e.g. via the more tag), reducing the number of posts shown on a given page, breaking your long posts into multiple pages, or using a plugin to lazy-load comments.",
"render-blocking-resources": "There are a number of WordPress plugins that can help you [inline critical assets](https://wordpress.org/plugins/search/critical+css/) or [defer less important resources](https://wordpress.org/plugins/search/defer+css+javascript/). Beware that optimizations provided by these plugins may break features of your theme or plugins, so you will likely need to make code changes.",
"unminified-css": "A number of [WordPress plugins](https://wordpress.org/plugins/search/minify+css/) can speed up your site by concatenating, minifying, and compressing your styles. You may also want to use a build process to do this minification up-front if possible.",
"unminified-javascript": "A number of [WordPress plugins](https://wordpress.org/plugins/search/minify+javascript/) can speed up your site by concatenating, minifying, and compressing your scripts. You may also want to use a build process to do this minification up front if possible.",
"efficient-animated-content": "Consider uploading your GIF to a service which will make it available to embed as an HTML5 video.",
"unused-javascript": "Consider reducing, or switching, the number of [WordPress plugins](https://wordpress.org/plugins/) loading unused JavaScript in your page. To identify plugins that are adding extraneous JS, try running [code coverage](https://developers.google.com/web/updates/2017/04/devtools-release-notes#coverage) in Chrome DevTools. You can identify the theme/plugin responsible from the URL of the script. Look out for plugins that have many scripts in the list which have a lot of red in code coverage. A plugin should only enqueue a script if it is actually used on the page.",
"unused-javascript": "Consider reducing, or switching, the number of [WordPress plugins](https://wordpress.org/plugins/) loading unused JavaScript in your page. To identify plugins that are adding extraneous JS, try running [code coverage](https://developer.chrome.com/docs/devtools/coverage/) in Chrome DevTools. You can identify the theme/plugin responsible from the URL of the script. Look out for plugins that have many scripts in the list which have a lot of red in code coverage. A plugin should only enqueue a script if it is actually used on the page.",
"uses-long-cache-ttl": "Read about [Browser Caching in WordPress](https://wordpress.org/support/article/optimization/#browser-caching).",
"uses-optimized-images": "Consider using an [image optimization WordPress plugin](https://wordpress.org/plugins/search/optimize+images/) that compresses your images while retaining quality.",
"uses-text-compression": "You can enable text compression in your web server configuration.",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"jpeg-js": "^0.4.3",
"js-library-detector": "^6.4.0",
"lighthouse-logger": "^1.3.0",
"lighthouse-stack-packs": "^1.6.0",
"lighthouse-stack-packs": "^1.7.0",
"lodash.clonedeep": "^4.5.0",
"lodash.get": "^4.4.2",
"lodash.isequal": "^4.5.0",
Expand Down
Loading

0 comments on commit eba2a4d

Please sign in to comment.