lighthouse 11.7.0-dev.20240407 → 11.7.0-dev.20240409

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/cli/test/smokehouse/config/exclusions.js +1 -0
  2. package/cli/test/smokehouse/core-tests.js +4 -0
  3. package/core/audits/redirects-http.d.ts +19 -0
  4. package/core/audits/redirects-http.js +75 -0
  5. package/core/computed/metrics/cumulative-layout-shift.js +2 -2
  6. package/core/computed/trace-engine-result.js +1 -1
  7. package/core/config/default-config.js +4 -7
  8. package/core/gather/driver/target-manager.js +1 -1
  9. package/core/gather/driver/wait-for-condition.js +2 -3
  10. package/core/gather/driver.js +1 -0
  11. package/core/gather/gatherers/trace-elements.d.ts +0 -10
  12. package/core/gather/gatherers/trace-elements.js +0 -19
  13. package/core/gather/session.d.ts +8 -0
  14. package/core/gather/session.js +12 -0
  15. package/core/runner.js +18 -23
  16. package/package.json +2 -2
  17. package/shared/localization/locales/ar-XB.json +0 -18
  18. package/shared/localization/locales/ar.json +0 -18
  19. package/shared/localization/locales/bg.json +0 -18
  20. package/shared/localization/locales/ca.json +0 -18
  21. package/shared/localization/locales/cs.json +0 -18
  22. package/shared/localization/locales/da.json +0 -18
  23. package/shared/localization/locales/de.json +0 -18
  24. package/shared/localization/locales/el.json +0 -18
  25. package/shared/localization/locales/en-GB.json +0 -18
  26. package/shared/localization/locales/en-US.json +9 -18
  27. package/shared/localization/locales/en-XA.json +0 -18
  28. package/shared/localization/locales/en-XL.json +9 -18
  29. package/shared/localization/locales/es-419.json +0 -18
  30. package/shared/localization/locales/es.json +0 -18
  31. package/shared/localization/locales/fi.json +0 -18
  32. package/shared/localization/locales/fil.json +0 -18
  33. package/shared/localization/locales/fr.json +0 -18
  34. package/shared/localization/locales/he.json +0 -18
  35. package/shared/localization/locales/hi.json +0 -18
  36. package/shared/localization/locales/hr.json +0 -18
  37. package/shared/localization/locales/hu.json +0 -18
  38. package/shared/localization/locales/id.json +0 -18
  39. package/shared/localization/locales/it.json +0 -18
  40. package/shared/localization/locales/ja.json +0 -18
  41. package/shared/localization/locales/ko.json +0 -18
  42. package/shared/localization/locales/lt.json +0 -18
  43. package/shared/localization/locales/lv.json +0 -18
  44. package/shared/localization/locales/nl.json +0 -18
  45. package/shared/localization/locales/no.json +0 -18
  46. package/shared/localization/locales/pl.json +0 -18
  47. package/shared/localization/locales/pt-PT.json +0 -18
  48. package/shared/localization/locales/pt.json +0 -18
  49. package/shared/localization/locales/ro.json +0 -18
  50. package/shared/localization/locales/ru.json +0 -18
  51. package/shared/localization/locales/sk.json +0 -18
  52. package/shared/localization/locales/sl.json +0 -18
  53. package/shared/localization/locales/sr-Latn.json +0 -18
  54. package/shared/localization/locales/sr.json +0 -18
  55. package/shared/localization/locales/sv.json +0 -18
  56. package/shared/localization/locales/ta.json +0 -18
  57. package/shared/localization/locales/te.json +0 -18
  58. package/shared/localization/locales/th.json +0 -18
  59. package/shared/localization/locales/tr.json +0 -18
  60. package/shared/localization/locales/uk.json +0 -18
  61. package/shared/localization/locales/vi.json +0 -18
  62. package/shared/localization/locales/zh-HK.json +0 -18
  63. package/shared/localization/locales/zh-TW.json +0 -18
  64. package/shared/localization/locales/zh.json +0 -18
  65. package/types/artifacts.d.ts +1 -13
  66. package/types/gatherer.d.ts +1 -0
  67. package/core/audits/layout-shift-elements.d.ts +0 -16
  68. package/core/audits/layout-shift-elements.js +0 -101
  69. package/core/audits/seo/plugins.d.ts +0 -15
  70. package/core/audits/seo/plugins.js +0 -150
  71. package/core/gather/gatherers/seo/embedded-content.d.ts +0 -10
  72. package/core/gather/gatherers/seo/embedded-content.js +0 -63
@@ -1148,15 +1148,6 @@
1148
1148
  "core/audits/largest-contentful-paint-element.js | title": {
1149
1149
  "message": "องค์ประกอบ Largest Contentful Paint"
1150
1150
  },
1151
- "core/audits/layout-shift-elements.js | columnContribution": {
1152
- "message": "ผลกระทบของการเปลี่ยนเลย์เอาต์"
1153
- },
1154
- "core/audits/layout-shift-elements.js | description": {
1155
- "message": "องค์ประกอบ DOM เหล่านี้ได้รับผลกระทบมากที่สุดจากการเปลี่ยนเลย์เอาต์ การเปลี่ยนเลย์เอาต์บางอย่างอาจไม่รวมอยู่ในค่าเมตริก CLS อันเนื่องมาจาก[การจัดกรอบเวลา](https://web.dev/articles/cls#what_is_cls) [ดูวิธีเพิ่มประสิทธิภาพ CLS](https://web.dev/articles/optimize-cls)"
1156
- },
1157
- "core/audits/layout-shift-elements.js | title": {
1158
- "message": "หลีกเลี่ยงการเลื่อนเลย์เอาต์ขนาดใหญ่"
1159
- },
1160
1151
  "core/audits/layout-shifts.js | columnScore": {
1161
1152
  "message": "คะแนนการเปลี่ยนเลย์เอาต์"
1162
1153
  },
@@ -1463,15 +1454,6 @@
1463
1454
  "core/audits/seo/meta-description.js | title": {
1464
1455
  "message": "เอกสารมีคำอธิบายเมตา"
1465
1456
  },
1466
- "core/audits/seo/plugins.js | description": {
1467
- "message": "เครื่องมือค้นหาจัดทำดัชนีเนื้อหาปลั๊กอินไม่ได้ และอุปกรณ์จำนวนมากจำกัดการใช้หรือไม่รองรับปลั๊กอิน [ดูข้อมูลเพิ่มเติมเกี่ยวกับการหลีกเลี่ยงปลั๊กอิน](https://developer.chrome.com/docs/lighthouse/seo/plugins/)"
1468
- },
1469
- "core/audits/seo/plugins.js | failureTitle": {
1470
- "message": "เอกสารใช้ปลั๊กอิน"
1471
- },
1472
- "core/audits/seo/plugins.js | title": {
1473
- "message": "เอกสารหลีกเลี่ยงการใช้ปลั๊กอิน"
1474
- },
1475
1457
  "core/audits/seo/robots-txt.js | description": {
1476
1458
  "message": "หากไฟล์ robots.txt มีรูปแบบไม่ถูกต้อง Crawler อาจไม่เข้าใจวิธีที่คุณต้องการให้ Crawl หรือจัดทำดัชนีเว็บไซต์ [ดูข้อมูลเพิ่มเติมเกี่ยวกับ robots.txt](https://developer.chrome.com/docs/lighthouse/seo/invalid-robots-txt/)"
1477
1459
  },
@@ -1148,15 +1148,6 @@
1148
1148
  "core/audits/largest-contentful-paint-element.js | title": {
1149
1149
  "message": "Largest Contentful Paint öğesi"
1150
1150
  },
1151
- "core/audits/layout-shift-elements.js | columnContribution": {
1152
- "message": "Düzen kaymasının etkisi"
1153
- },
1154
- "core/audits/layout-shift-elements.js | description": {
1155
- "message": "Düzen kaymalarından en çok bu DOM öğeleri etkilendi. [Pencereleme](https://web.dev/articles/cls#what_is_cls) nedeniyle CLS metriği değerine bazı düzen kaymaları dahil edilmeyebilir. [CLS'yi nasıl iyileştireceğinizi öğrenin](https://web.dev/articles/optimize-cls)"
1156
- },
1157
- "core/audits/layout-shift-elements.js | title": {
1158
- "message": "Büyük düzen kaymalarından kaçının"
1159
- },
1160
1151
  "core/audits/layout-shifts.js | columnScore": {
1161
1152
  "message": "Düzen kayması puanı"
1162
1153
  },
@@ -1463,15 +1454,6 @@
1463
1454
  "core/audits/seo/meta-description.js | title": {
1464
1455
  "message": "Doküman meta tanım içeriyor"
1465
1456
  },
1466
- "core/audits/seo/plugins.js | description": {
1467
- "message": "Arama motorları eklenti içeriğini dizine ekleyemez. Ayrıca birçok cihaz eklentileri kısıtlar veya desteklemez. [Eklentilerden kaçınma hakkında daha fazla bilgi edinin](https://developer.chrome.com/docs/lighthouse/seo/plugins/)."
1468
- },
1469
- "core/audits/seo/plugins.js | failureTitle": {
1470
- "message": "Doküman, eklenti kullanıyor"
1471
- },
1472
- "core/audits/seo/plugins.js | title": {
1473
- "message": "Doküman eklenti içermiyor"
1474
- },
1475
1457
  "core/audits/seo/robots-txt.js | description": {
1476
1458
  "message": "robots.txt dosyanız yanlış biçimlendirilmişse, tarayıcılar web sitenizin nasıl taranmasını veya dizine eklenmesini istediğinizi anlayamayabilir. [Robots.txt hakkında daha fazla bilgi edinin](https://developer.chrome.com/docs/lighthouse/seo/invalid-robots-txt/)."
1477
1459
  },
@@ -1148,15 +1148,6 @@
1148
1148
  "core/audits/largest-contentful-paint-element.js | title": {
1149
1149
  "message": "Елемент візуалізації великого контенту"
1150
1150
  },
1151
- "core/audits/layout-shift-elements.js | columnContribution": {
1152
- "message": "Вплив зміщень макета"
1153
- },
1154
- "core/audits/layout-shift-elements.js | description": {
1155
- "message": "Зміщення макета найбільше вплинули на ці елементи DOM. Деякі зміщення можуть не включатися в значення показника CLS через [віконізацію](https://web.dev/articles/cls#what_is_cls). [Дізнайтесь, як покращити показник CLS.](https://web.dev/articles/optimize-cls)"
1156
- },
1157
- "core/audits/layout-shift-elements.js | title": {
1158
- "message": "Уникайте великих зсувів макета"
1159
- },
1160
1151
  "core/audits/layout-shifts.js | columnScore": {
1161
1152
  "message": "Показник зміщення макета"
1162
1153
  },
@@ -1463,15 +1454,6 @@
1463
1454
  "core/audits/seo/meta-description.js | title": {
1464
1455
  "message": "Документ містить метаопис"
1465
1456
  },
1466
- "core/audits/seo/plugins.js | description": {
1467
- "message": "Пошукові системи не можуть індексувати вміст плагінів. Багато пристроїв обмежують або не підтримують плагіни. [Докладніше про те, як уникати плагінів.](https://developer.chrome.com/docs/lighthouse/seo/plugins/)"
1468
- },
1469
- "core/audits/seo/plugins.js | failureTitle": {
1470
- "message": "Документ використовує плагіни"
1471
- },
1472
- "core/audits/seo/plugins.js | title": {
1473
- "message": "Документ уникає плагінів"
1474
- },
1475
1457
  "core/audits/seo/robots-txt.js | description": {
1476
1458
  "message": "Якщо файл robots.txt недійсний, веб-сканери можуть не зрозуміти, як потрібно індексувати або сканувати ваш веб-сайт. [Докладніше про файл robots.txt.](https://developer.chrome.com/docs/lighthouse/seo/invalid-robots-txt/)"
1477
1459
  },
@@ -1148,15 +1148,6 @@
1148
1148
  "core/audits/largest-contentful-paint-element.js | title": {
1149
1149
  "message": "Thành phần Thời gian hiển thị nội dung lớn nhất"
1150
1150
  },
1151
- "core/audits/layout-shift-elements.js | columnContribution": {
1152
- "message": "Ảnh hưởng của việc thay đổi bố cục"
1153
- },
1154
- "core/audits/layout-shift-elements.js | description": {
1155
- "message": "Các phần tử DOM này là đối tượng chịu ảnh hưởng nhiều nhất của việc thay đổi bố cục. Một số thay đổi về bố cục có thể không được tính vào giá trị chỉ số CLS do phương pháp [chuẩn hoá](https://web.dev/articles/cls#what_is_cls). [Tìm hiểu cách cải thiện CLS](https://web.dev/articles/optimize-cls)"
1156
- },
1157
- "core/audits/layout-shift-elements.js | title": {
1158
- "message": "Tránh các thay đổi lớn về bố cục"
1159
- },
1160
1151
  "core/audits/layout-shifts.js | columnScore": {
1161
1152
  "message": "Điểm số về mức thay đổi bố cục"
1162
1153
  },
@@ -1463,15 +1454,6 @@
1463
1454
  "core/audits/seo/meta-description.js | title": {
1464
1455
  "message": "Tài liệu có phần mô tả meta"
1465
1456
  },
1466
- "core/audits/seo/plugins.js | description": {
1467
- "message": "Các công cụ tìm kiếm không thể lập chỉ mục nội dung trình bổ trợ và nhiều thiết bị hạn chế hoặc không hỗ trợ trình bổ trợ. [Tìm hiểu thêm về cách tránh trình bổ trợ](https://developer.chrome.com/docs/lighthouse/seo/plugins/)."
1468
- },
1469
- "core/audits/seo/plugins.js | failureTitle": {
1470
- "message": "Tài liệu sử dụng plugin"
1471
- },
1472
- "core/audits/seo/plugins.js | title": {
1473
- "message": "Tài liệu tránh sử dụng plugin"
1474
- },
1475
1457
  "core/audits/seo/robots-txt.js | description": {
1476
1458
  "message": "Nếu định dạng của tệp robots.txt không đúng, thì trình thu thập thông tin có thể không hiểu được cách bạn muốn thu thập thông tin hoặc lập chỉ mục trang web của mình. [Tìm hiểu thêm về tệp robots.txt](https://developer.chrome.com/docs/lighthouse/seo/invalid-robots-txt/)."
1477
1459
  },
@@ -1148,15 +1148,6 @@
1148
1148
  "core/audits/largest-contentful-paint-element.js | title": {
1149
1149
  "message": "「最大內容繪製」元素"
1150
1150
  },
1151
- "core/audits/layout-shift-elements.js | columnContribution": {
1152
- "message": "受版面配置轉移影響的元素數量"
1153
- },
1154
- "core/audits/layout-shift-elements.js | description": {
1155
- "message": "版面配置轉移對這些 DOM 元素造成的影響最大。由於[視窗化](https://web.dev/articles/cls#what_is_cls),部分版面配置轉移可能不會包含在 CLS 數據值中。[瞭解如何改善累計版面配置轉移 (CLS)](https://web.dev/articles/optimize-cls)"
1156
- },
1157
- "core/audits/layout-shift-elements.js | title": {
1158
- "message": "避免大幅度的版面配置轉移"
1159
- },
1160
1151
  "core/audits/layout-shifts.js | columnScore": {
1161
1152
  "message": "版面配置轉移分數"
1162
1153
  },
@@ -1463,15 +1454,6 @@
1463
1454
  "core/audits/seo/meta-description.js | title": {
1464
1455
  "message": "文件具有中繼說明"
1465
1456
  },
1466
- "core/audits/seo/plugins.js | description": {
1467
- "message": "搜尋引擎無法為外掛程式內容加入索引,而且很多裝置對外掛程式都設有限制甚至不提供支援。[進一步瞭解如何避免使用外掛程式](https://developer.chrome.com/docs/lighthouse/seo/plugins/)。"
1468
- },
1469
- "core/audits/seo/plugins.js | failureTitle": {
1470
- "message": "文件使用外掛程式"
1471
- },
1472
- "core/audits/seo/plugins.js | title": {
1473
- "message": "文件避免使用外掛程式"
1474
- },
1475
1457
  "core/audits/seo/robots-txt.js | description": {
1476
1458
  "message": "如果您的 robots.txt 檔案格式錯誤,檢索器可能無法瞭解您偏好的網站檢索或加入索引方式。[進一步瞭解 robots.txt](https://developer.chrome.com/docs/lighthouse/seo/invalid-robots-txt/)。"
1477
1459
  },
@@ -1148,15 +1148,6 @@
1148
1148
  "core/audits/largest-contentful-paint-element.js | title": {
1149
1149
  "message": "最大內容繪製元素"
1150
1150
  },
1151
- "core/audits/layout-shift-elements.js | columnContribution": {
1152
- "message": "受版面配置位移影響的元素數量"
1153
- },
1154
- "core/audits/layout-shift-elements.js | description": {
1155
- "message": "版面配置位移對這些 DOM 元素造成的影響最大。由於[執行時間較短](https://web.dev/articles/cls#what_is_cls),部分版面配置位移可能不會包含在 CLS 指標值中。[瞭解如何改善 CLS](https://web.dev/articles/optimize-cls)"
1156
- },
1157
- "core/audits/layout-shift-elements.js | title": {
1158
- "message": "避免大量版面配置轉移"
1159
- },
1160
1151
  "core/audits/layout-shifts.js | columnScore": {
1161
1152
  "message": "版面配置位移分數"
1162
1153
  },
@@ -1463,15 +1454,6 @@
1463
1454
  "core/audits/seo/meta-description.js | title": {
1464
1455
  "message": "文件具有中繼說明"
1465
1456
  },
1466
- "core/audits/seo/plugins.js | description": {
1467
- "message": "搜尋引擎無法為外掛程式內容建立索引,而且許多裝置對外掛程式設有限制或不提供支援。[進一步瞭解如何避免使用外掛程式](https://developer.chrome.com/docs/lighthouse/seo/plugins/)。"
1468
- },
1469
- "core/audits/seo/plugins.js | failureTitle": {
1470
- "message": "文件使用外掛程式"
1471
- },
1472
- "core/audits/seo/plugins.js | title": {
1473
- "message": "文件盡量不使用外掛程式"
1474
- },
1475
1457
  "core/audits/seo/robots-txt.js | description": {
1476
1458
  "message": "如果 robots.txt 檔案格式錯誤,檢索器可能無法瞭解你偏好的網站檢索方式或索引建立方式。[進一步瞭解 robots.txt](https://developer.chrome.com/docs/lighthouse/seo/invalid-robots-txt/)。"
1477
1459
  },
@@ -1148,15 +1148,6 @@
1148
1148
  "core/audits/largest-contentful-paint-element.js | title": {
1149
1149
  "message": "最大内容渲染时间元素"
1150
1150
  },
1151
- "core/audits/layout-shift-elements.js | columnContribution": {
1152
- "message": "布局偏移的影响"
1153
- },
1154
- "core/audits/layout-shift-elements.js | description": {
1155
- "message": "这些 DOM 元素受布局偏移的影响最大。由于[窗口化](https://web.dev/articles/cls#what_is_cls)的原因,某些布局偏移可能未包含在 CLS 指标值中。[了解如何改善 CLS](https://web.dev/articles/optimize-cls)"
1156
- },
1157
- "core/audits/layout-shift-elements.js | title": {
1158
- "message": "请避免出现大幅度的布局偏移"
1159
- },
1160
1151
  "core/audits/layout-shifts.js | columnScore": {
1161
1152
  "message": "布局偏移分数"
1162
1153
  },
@@ -1463,15 +1454,6 @@
1463
1454
  "core/audits/seo/meta-description.js | title": {
1464
1455
  "message": "文档有 meta 描述"
1465
1456
  },
1466
- "core/audits/seo/plugins.js | description": {
1467
- "message": "搜索引擎无法将插件内容编入索引,而且许多设备都限制或不支持使用插件。[详细了解如何避免使用插件](https://developer.chrome.com/docs/lighthouse/seo/plugins/)。"
1468
- },
1469
- "core/audits/seo/plugins.js | failureTitle": {
1470
- "message": "文档使用了插件"
1471
- },
1472
- "core/audits/seo/plugins.js | title": {
1473
- "message": "文档中没有插件"
1474
- },
1475
1457
  "core/audits/seo/robots-txt.js | description": {
1476
1458
  "message": "如果 robots.txt 文件的格式不正确,抓取工具可能无法理解您希望以何种方式抓取网站内容或将其编入索引。[详细了解 robots.txt](https://developer.chrome.com/docs/lighthouse/seo/invalid-robots-txt/)。"
1477
1459
  },
@@ -119,8 +119,6 @@ export interface GathererArtifacts extends PublicGathererArtifacts {
119
119
  Doctype: Artifacts.Doctype | null;
120
120
  /** Information on the size of all DOM nodes in the page and the most extreme members. */
121
121
  DOMStats: Artifacts.DOMStats;
122
- /** Relevant attributes and child properties of all <object>s, <embed>s and <applet>s in the page. */
123
- EmbeddedContent: Artifacts.EmbeddedContentInfo[];
124
122
  /** Information on poorly sized font usage and the text affected by it. */
125
123
  FontSize: Artifacts.FontSize;
126
124
  /** All the input elements, including associated form and label elements. */
@@ -249,16 +247,6 @@ declare module Artifacts {
249
247
  depth: NodeDetails & {max: number;};
250
248
  }
251
249
 
252
- interface EmbeddedContentInfo {
253
- tagName: string;
254
- type: string | null;
255
- src: string | null;
256
- data: string | null;
257
- code: string | null;
258
- params: Array<{name: string; value: string}>;
259
- node: Artifacts.NodeDetails;
260
- }
261
-
262
250
  interface IFrameElement {
263
251
  /** The `id` attribute of the iframe. */
264
252
  id: string,
@@ -561,7 +549,7 @@ declare module Artifacts {
561
549
  }
562
550
 
563
551
  interface TraceElement {
564
- traceEventType: 'largest-contentful-paint'|'layout-shift'|'layout-shift-element'|'animation'|'responsiveness';
552
+ traceEventType: 'largest-contentful-paint'|'layout-shift'|'animation'|'responsiveness';
565
553
  node: NodeDetails;
566
554
  nodeId: number;
567
555
  animations?: {name?: string, failureReasonsMask?: number, unsupportedProperties?: string[]}[];
@@ -33,6 +33,7 @@ declare module Gatherer {
33
33
  once<TEvent extends keyof CrdpEvents>(event: TEvent, callback: (...args: CrdpEvents[TEvent]) => void): void;
34
34
  off<TEvent extends keyof CrdpEvents>(event: TEvent, callback: (...args: CrdpEvents[TEvent]) => void): void;
35
35
  sendCommand<TMethod extends keyof CrdpCommands>(method: TMethod, ...params: CrdpCommands[TMethod]['paramsType']): Promise<CrdpCommands[TMethod]['returnType']>;
36
+ sendCommandAndIgnore<TMethod extends keyof CrdpCommands>(method: TMethod, ...params: CrdpCommands[TMethod]['paramsType']): Promise<void>;
36
37
  dispose(): Promise<void>;
37
38
  }
38
39
 
@@ -1,16 +0,0 @@
1
- export default LayoutShiftElements;
2
- declare class LayoutShiftElements extends Audit {
3
- /**
4
- * @param {LH.Artifacts} artifacts
5
- * @param {LH.Audit.Context} context
6
- * @return {Promise<LH.Audit.Product>}
7
- */
8
- static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
9
- }
10
- export namespace UIStrings {
11
- const title: string;
12
- const description: string;
13
- const columnContribution: string;
14
- }
15
- import { Audit } from './audit.js';
16
- //# sourceMappingURL=layout-shift-elements.d.ts.map
@@ -1,101 +0,0 @@
1
- /**
2
- * @license Copyright 2020 Google LLC
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
-
6
- import {Audit} from './audit.js';
7
- import * as i18n from '../lib/i18n/i18n.js';
8
- import {CumulativeLayoutShift as CumulativeLayoutShiftComputed} from '../computed/metrics/cumulative-layout-shift.js';
9
- import CumulativeLayoutShift from './metrics/cumulative-layout-shift.js';
10
-
11
- const UIStrings = {
12
- /** Descriptive title of a diagnostic audit that provides the top elements affected by layout shifts. */
13
- title: 'Avoid large layout shifts',
14
- /** Description of a diagnostic audit that provides the top elements affected by layout shifts. "windowing" means the metric value is calculated using the subset of events in a small window of time during the run. "normalization" is a good substitute for "windowing". The last sentence starting with 'Learn' becomes link text to additional documentation. */
15
- description: 'These DOM elements were most affected by layout shifts. Some layout shifts may not be included in the CLS metric value due to [windowing](https://web.dev/articles/cls#what_is_cls). [Learn how to improve CLS](https://web.dev/articles/optimize-cls)',
16
- /** Label for a column in a data table; entries in this column will be the amount that the corresponding element affected by layout shifts. */
17
- columnContribution: 'Layout shift impact',
18
- };
19
-
20
- const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
21
-
22
- class LayoutShiftElements extends Audit {
23
- /**
24
- * @return {LH.Audit.Meta}
25
- */
26
- static get meta() {
27
- return {
28
- id: 'layout-shift-elements',
29
- title: str_(UIStrings.title),
30
- description: str_(UIStrings.description),
31
- scoreDisplayMode: Audit.SCORING_MODES.METRIC_SAVINGS,
32
- guidanceLevel: 2,
33
- requiredArtifacts: ['traces', 'TraceElements'],
34
- };
35
- }
36
-
37
- /**
38
- * @param {LH.Artifacts} artifacts
39
- * @param {LH.Audit.Context} context
40
- * @return {Promise<LH.Audit.Product>}
41
- */
42
- static async audit(artifacts, context) {
43
- const {cumulativeLayoutShift: clsSavings, impactByNodeId} =
44
- await CumulativeLayoutShiftComputed.request(artifacts.traces[Audit.DEFAULT_PASS], context);
45
-
46
- /** @type {Array<{node: LH.Audit.Details.ItemValue, score: number}>} */
47
- const clsElementData = artifacts.TraceElements
48
- .filter(element => element.traceEventType === 'layout-shift-element')
49
- .map(element => ({
50
- node: Audit.makeNodeItem(element.node),
51
- score: impactByNodeId.get(element.nodeId) || 0,
52
- }));
53
-
54
- if (clsElementData.length < impactByNodeId.size) {
55
- const displayedNodeImpact = clsElementData.reduce((sum, {score}) => sum += score, 0);
56
-
57
- // This is not necessarily the same as CLS due to normalization.
58
- const totalNodeImpact = Array.from(impactByNodeId.values())
59
- .reduce((sum, score) => sum + score);
60
-
61
- clsElementData.push({
62
- node: {
63
- type: 'code',
64
- value: str_(i18n.UIStrings.otherResourceType),
65
- },
66
- score: totalNodeImpact - displayedNodeImpact,
67
- });
68
- }
69
-
70
- /** @type {LH.Audit.Details.Table['headings']} */
71
- const headings = [
72
- {key: 'node', valueType: 'node', label: str_(i18n.UIStrings.columnElement)},
73
- {key: 'score', valueType: 'numeric',
74
- granularity: 0.001, label: str_(UIStrings.columnContribution)},
75
- ];
76
-
77
- const details = Audit.makeTableDetails(headings, clsElementData);
78
-
79
- let displayValue;
80
- if (impactByNodeId.size > 0) {
81
- displayValue = str_(i18n.UIStrings.displayValueElementsFound,
82
- {nodeCount: impactByNodeId.size});
83
- }
84
-
85
- const passed = clsSavings <= CumulativeLayoutShift.defaultOptions.p10;
86
-
87
- return {
88
- score: passed ? 1 : 0,
89
- scoreDisplayMode: passed ? Audit.SCORING_MODES.INFORMATIVE : undefined,
90
- metricSavings: {
91
- CLS: clsSavings,
92
- },
93
- notApplicable: details.items.length === 0,
94
- displayValue,
95
- details,
96
- };
97
- }
98
- }
99
-
100
- export default LayoutShiftElements;
101
- export {UIStrings};
@@ -1,15 +0,0 @@
1
- export default Plugins;
2
- declare class Plugins extends Audit {
3
- /**
4
- * @param {LH.Artifacts} artifacts
5
- * @return {LH.Audit.Product}
6
- */
7
- static audit(artifacts: LH.Artifacts): LH.Audit.Product;
8
- }
9
- export namespace UIStrings {
10
- const title: string;
11
- const failureTitle: string;
12
- const description: string;
13
- }
14
- import { Audit } from '../audit.js';
15
- //# sourceMappingURL=plugins.d.ts.map
@@ -1,150 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- import {Audit} from '../audit.js';
8
- import * as i18n from '../../lib/i18n/i18n.js';
9
-
10
- const JAVA_APPLET_TYPE = 'application/x-java-applet';
11
- const JAVA_BEAN_TYPE = 'application/x-java-bean';
12
- const TYPE_BLOCKLIST = new Set([
13
- 'application/x-shockwave-flash',
14
- // See https://docs.oracle.com/cd/E19683-01/816-0378/using_tags/index.html
15
- JAVA_APPLET_TYPE,
16
- JAVA_BEAN_TYPE,
17
- // See https://msdn.microsoft.com/es-es/library/cc265156(v=vs.95).aspx
18
- 'application/x-silverlight',
19
- 'application/x-silverlight-2',
20
- ]);
21
- const FILE_EXTENSION_BLOCKLIST = new Set([
22
- 'swf',
23
- 'flv',
24
- 'class',
25
- 'xap',
26
- ]);
27
- const SOURCE_PARAMS = new Set([
28
- 'code',
29
- 'movie',
30
- 'source',
31
- 'src',
32
- ]);
33
-
34
- const UIStrings = {
35
- /** Title of a Lighthouse audit that provides detail on the browser plugins used by the page. This descriptive title is shown when there is no plugin content on the page that would restrict search indexing. */
36
- title: 'Document avoids plugins',
37
- /** Descriptive title of a Lighthouse audit that provides detail on the browser plugins used by the page. This title is shown when there is plugin content on the page. */
38
- failureTitle: 'Document uses plugins',
39
- /** Description of a Lighthouse audit that tells the user *why* they need to avoid using browser plugins in their content. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
40
- description: 'Search engines can\'t index plugin content, and ' +
41
- 'many devices restrict plugins or don\'t support them. ' +
42
- '[Learn more about avoiding plugins](https://developer.chrome.com/docs/lighthouse/seo/plugins/).',
43
- };
44
-
45
- const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
46
-
47
- /**
48
- * Verifies if given MIME type matches any known plugin MIME type
49
- * @param {string} type
50
- * @return {boolean}
51
- */
52
- function isPluginType(type) {
53
- type = type.trim().toLowerCase();
54
-
55
- return TYPE_BLOCKLIST.has(type) ||
56
- type.startsWith(JAVA_APPLET_TYPE) || // e.g. "application/x-java-applet;jpi-version=1.4"
57
- type.startsWith(JAVA_BEAN_TYPE);
58
- }
59
-
60
- /**
61
- * Verifies if given url points to a file that has a known plugin extension
62
- * @param {string} url
63
- * @return {boolean}
64
- */
65
- function isPluginURL(url) {
66
- try {
67
- // in order to support relative URLs we need to provied a base URL
68
- const filePath = new URL(url, 'http://example.com').pathname;
69
- const parts = filePath.split('.');
70
-
71
- if (parts.length < 2) {
72
- return false;
73
- }
74
- const part = parts[parts.length - 1];
75
- return FILE_EXTENSION_BLOCKLIST.has(part.trim().toLowerCase());
76
- } catch (e) {
77
- return false;
78
- }
79
- }
80
-
81
- class Plugins extends Audit {
82
- /**
83
- * @return {LH.Audit.Meta}
84
- */
85
- static get meta() {
86
- return {
87
- id: 'plugins',
88
- title: str_(UIStrings.title),
89
- failureTitle: str_(UIStrings.failureTitle),
90
- description: str_(UIStrings.description),
91
- requiredArtifacts: ['EmbeddedContent'],
92
- };
93
- }
94
-
95
- /**
96
- * @param {LH.Artifacts} artifacts
97
- * @return {LH.Audit.Product}
98
- */
99
- static audit(artifacts) {
100
- const plugins = artifacts.EmbeddedContent
101
- .filter(item => {
102
- if (item.tagName === 'APPLET') {
103
- return true;
104
- }
105
-
106
- if (
107
- (item.tagName === 'EMBED' || item.tagName === 'OBJECT') &&
108
- item.type &&
109
- isPluginType(item.type)
110
- ) {
111
- return true;
112
- }
113
-
114
- const embedSrc = item.src || item.code;
115
- if (item.tagName === 'EMBED' && embedSrc && isPluginURL(embedSrc)) {
116
- return true;
117
- }
118
-
119
- if (item.tagName === 'OBJECT' && item.data && isPluginURL(item.data)) {
120
- return true;
121
- }
122
-
123
- const failingParams = item.params.filter(param =>
124
- SOURCE_PARAMS.has(param.name.trim().toLowerCase()) && isPluginURL(param.value)
125
- );
126
-
127
- return failingParams.length > 0;
128
- })
129
- .map(plugin => {
130
- return {
131
- source: Audit.makeNodeItem(plugin.node),
132
- };
133
- });
134
-
135
- /** @type {LH.Audit.Details.Table['headings']} */
136
- const headings = [
137
- {key: 'source', valueType: 'code', label: 'Element source'},
138
- ];
139
-
140
- const details = Audit.makeTableDetails(headings, plugins);
141
-
142
- return {
143
- score: Number(plugins.length === 0),
144
- details,
145
- };
146
- }
147
- }
148
-
149
- export default Plugins;
150
- export {UIStrings};
@@ -1,10 +0,0 @@
1
- export default EmbeddedContent;
2
- declare class EmbeddedContent extends BaseGatherer {
3
- /**
4
- * @param {LH.Gatherer.Context} passContext
5
- * @return {Promise<LH.Artifacts['EmbeddedContent']>}
6
- */
7
- getArtifact(passContext: LH.Gatherer.Context): Promise<LH.Artifacts['EmbeddedContent']>;
8
- }
9
- import BaseGatherer from '../../base-gatherer.js';
10
- //# sourceMappingURL=embedded-content.d.ts.map
@@ -1,63 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- /* globals getElementsInDocument getNodeDetails */
8
-
9
- import BaseGatherer from '../../base-gatherer.js';
10
- import {pageFunctions} from '../../../lib/page-functions.js';
11
-
12
- /**
13
- * @return {LH.Artifacts.EmbeddedContentInfo[]}
14
- */
15
- function getEmbeddedContent() {
16
- const functions = /** @type {typeof pageFunctions} */ ({
17
- // @ts-expect-error - getElementsInDocument put into scope via stringification
18
- getElementsInDocument,
19
- // @ts-expect-error - getNodeDetails put into scope via stringification
20
- getNodeDetails,
21
- });
22
-
23
- const selector = 'object, embed, applet';
24
- const elements = functions.getElementsInDocument(selector);
25
- return elements
26
- .map(node => ({
27
- tagName: node.tagName,
28
- type: node.getAttribute('type'),
29
- src: node.getAttribute('src'),
30
- data: node.getAttribute('data'),
31
- code: node.getAttribute('code'),
32
- params: Array.from(node.children)
33
- .filter(el => el.tagName === 'PARAM')
34
- .map(el => ({
35
- name: el.getAttribute('name') || '',
36
- value: el.getAttribute('value') || '',
37
- })),
38
- node: functions.getNodeDetails(node),
39
- }));
40
- }
41
-
42
- class EmbeddedContent extends BaseGatherer {
43
- /** @type {LH.Gatherer.GathererMeta} */
44
- meta = {
45
- supportedModes: ['snapshot', 'navigation'],
46
- };
47
-
48
- /**
49
- * @param {LH.Gatherer.Context} passContext
50
- * @return {Promise<LH.Artifacts['EmbeddedContent']>}
51
- */
52
- getArtifact(passContext) {
53
- return passContext.driver.executionContext.evaluate(getEmbeddedContent, {
54
- args: [],
55
- deps: [
56
- pageFunctions.getElementsInDocument,
57
- pageFunctions.getNodeDetails,
58
- ],
59
- });
60
- }
61
- }
62
-
63
- export default EmbeddedContent;