lighthouse 8.6.0 → 9.0.0

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 (209) hide show
  1. package/dist/report/bundle.esm.js +5994 -0
  2. package/dist/report/flow.js +30 -13
  3. package/dist/report/standalone.js +41 -35
  4. package/flow-report/.eslintrc.cjs +2 -0
  5. package/flow-report/assets/standalone-flow-template.html +3 -2
  6. package/flow-report/assets/styles.css +108 -31
  7. package/flow-report/src/app.tsx +18 -18
  8. package/flow-report/src/common.tsx +28 -15
  9. package/flow-report/src/header.tsx +12 -13
  10. package/flow-report/src/help-dialog.tsx +3 -4
  11. package/flow-report/src/i18n/i18n.tsx +57 -16
  12. package/flow-report/src/i18n/ui-strings.js +50 -0
  13. package/flow-report/src/icons.tsx +36 -8
  14. package/flow-report/src/sidebar/flow.tsx +3 -3
  15. package/flow-report/src/sidebar/sidebar.tsx +35 -14
  16. package/flow-report/src/summary/category.tsx +97 -24
  17. package/flow-report/src/summary/summary.tsx +21 -14
  18. package/flow-report/src/topbar.tsx +9 -5
  19. package/flow-report/src/util.ts +33 -26
  20. package/flow-report/src/wrappers/category-score.tsx +0 -3
  21. package/flow-report/src/wrappers/markdown.tsx +27 -0
  22. package/flow-report/src/wrappers/report-renderer.tsx +10 -3
  23. package/flow-report/src/wrappers/report.tsx +27 -6
  24. package/flow-report/standalone-flow.tsx +4 -3
  25. package/flow-report/test/common-test.tsx +32 -17
  26. package/flow-report/test/flow-report-pptr-test.ts +46 -0
  27. package/flow-report/test/header-test.tsx +6 -6
  28. package/flow-report/test/setup/env-setup.ts +1 -1
  29. package/flow-report/test/sidebar/sidebar-test.tsx +43 -1
  30. package/flow-report/test/summary/category-test.tsx +120 -24
  31. package/flow-report/test/summary/summary-test.tsx +1 -1
  32. package/flow-report/test/topbar-test.tsx +1 -0
  33. package/flow-report/test/util-test.tsx +32 -11
  34. package/flow-report/test/wrappers/category-score-test.tsx +87 -0
  35. package/flow-report/test/wrappers/markdown-test.tsx +29 -0
  36. package/flow-report/tsconfig.json +1 -0
  37. package/jest.config.js +4 -2
  38. package/lighthouse-cli/.eslintrc.cjs +2 -0
  39. package/lighthouse-cli/cli-flags.js +1 -1
  40. package/lighthouse-cli/run.js +1 -1
  41. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
  42. package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +4 -2
  43. package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +1 -1
  44. package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
  45. package/lighthouse-core/audits/accessibility/axe-audit.js +7 -1
  46. package/lighthouse-core/audits/audit.js +1 -1
  47. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +2 -0
  48. package/lighthouse-core/audits/byte-efficiency/modern-image-formats.js +4 -2
  49. package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +11 -10
  50. package/lighthouse-core/audits/byte-efficiency/uses-optimized-images.js +5 -3
  51. package/lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js +2 -1
  52. package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +2 -1
  53. package/lighthouse-core/audits/deprecations.js +33 -11
  54. package/lighthouse-core/audits/dobetterweb/uses-http2.js +27 -11
  55. package/lighthouse-core/audits/errors-in-console.js +0 -2
  56. package/lighthouse-core/audits/image-aspect-ratio.js +5 -5
  57. package/lighthouse-core/audits/image-size-responsive.js +6 -6
  58. package/lighthouse-core/audits/installable-manifest.js +5 -3
  59. package/lighthouse-core/audits/preload-lcp-image.js +7 -5
  60. package/lighthouse-core/audits/script-treemap-data.js +1 -1
  61. package/lighthouse-core/audits/unsized-images.js +2 -3
  62. package/lighthouse-core/computed/image-records.js +4 -3
  63. package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +3 -4
  64. package/lighthouse-core/computed/metrics/tbt-utils.js +57 -0
  65. package/lighthouse-core/computed/metrics/total-blocking-time.js +3 -53
  66. package/lighthouse-core/computed/resource-summary.js +1 -1
  67. package/lighthouse-core/config/config-helpers.js +21 -10
  68. package/lighthouse-core/config/constants.js +3 -4
  69. package/lighthouse-core/config/default-config.js +61 -71
  70. package/lighthouse-core/fraggle-rock/config/config.js +1 -1
  71. package/lighthouse-core/fraggle-rock/config/default-config.js +4 -5
  72. package/lighthouse-core/fraggle-rock/gather/base-gatherer.js +6 -1
  73. package/lighthouse-core/fraggle-rock/gather/session.js +3 -4
  74. package/lighthouse-core/gather/connections/cri.js +1 -1
  75. package/lighthouse-core/gather/driver/storage.js +0 -1
  76. package/lighthouse-core/gather/driver.js +3 -7
  77. package/lighthouse-core/gather/fetcher.js +4 -7
  78. package/lighthouse-core/gather/gather-runner.js +29 -6
  79. package/lighthouse-core/gather/gatherers/accessibility.js +27 -0
  80. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -0
  81. package/lighthouse-core/gather/gatherers/image-elements.js +0 -3
  82. package/lighthouse-core/gather/gatherers/inspector-issues.js +5 -0
  83. package/lighthouse-core/lib/asset-saver.js +7 -4
  84. package/lighthouse-core/lib/emulation.js +45 -1
  85. package/lighthouse-core/lib/i18n/i18n.js +19 -8
  86. package/lighthouse-core/lib/lh-env.js +2 -0
  87. package/lighthouse-core/lib/proto-preprocessor.js +14 -2
  88. package/lighthouse-core/lib/tappable-rects.js +8 -15
  89. package/lighthouse-core/lib/url-shim.js +1 -1
  90. package/lighthouse-core/runner.js +1 -1
  91. package/lighthouse-core/util-commonjs.js +65 -46
  92. package/package.json +27 -17
  93. package/readme.md +3 -3
  94. package/report/.eslintrc.cjs +2 -0
  95. package/report/README.md +1 -1
  96. package/report/assets/standalone-template.html +2 -3
  97. package/report/assets/styles.css +360 -254
  98. package/report/assets/templates.html +21 -76
  99. package/report/clients/bundle.js +1 -0
  100. package/report/clients/standalone.js +6 -15
  101. package/report/generator/README.md +1 -1
  102. package/report/renderer/api.js +32 -0
  103. package/report/renderer/category-renderer.js +59 -19
  104. package/report/renderer/components.js +59 -110
  105. package/report/renderer/crc-details-renderer.js +15 -12
  106. package/report/renderer/dom.js +16 -1
  107. package/report/renderer/drop-down-menu.js +2 -2
  108. package/report/renderer/element-screenshot-renderer.js +8 -8
  109. package/report/renderer/features-util.js +1 -1
  110. package/report/renderer/open-tab.js +9 -3
  111. package/report/renderer/performance-category-renderer.js +55 -34
  112. package/report/renderer/pwa-category-renderer.js +0 -10
  113. package/report/renderer/report-renderer.js +91 -44
  114. package/report/renderer/report-ui-features.js +36 -33
  115. package/report/renderer/swap-locale-feature.js +3 -3
  116. package/report/renderer/topbar-features.js +53 -48
  117. package/report/renderer/util.js +66 -46
  118. package/report/test/clients/bundle-test.js +70 -0
  119. package/report/test/renderer/category-renderer-test.js +48 -3
  120. package/report/test/renderer/i18n-test.js +0 -7
  121. package/report/test/renderer/performance-category-renderer-test.js +51 -14
  122. package/report/test/renderer/pwa-category-renderer-test.js +6 -6
  123. package/report/test/renderer/report-renderer-axe-test.js +10 -12
  124. package/report/test/renderer/report-renderer-test.js +23 -22
  125. package/report/test/renderer/report-ui-features-test.js +20 -10
  126. package/report/test/renderer/text-encoding-test.js +1 -1
  127. package/report/test/renderer/util-test.js +35 -31
  128. package/report/test-assets/faux-psi-template.html +3 -11
  129. package/report/test-assets/faux-psi.js +26 -22
  130. package/report/types/html-renderer.d.ts +2 -0
  131. package/report/types/report-renderer.d.ts +23 -0
  132. package/shared/localization/format.js +64 -30
  133. package/shared/localization/locales/ar-XB.json +72 -75
  134. package/shared/localization/locales/ar.json +72 -75
  135. package/shared/localization/locales/bg.json +72 -75
  136. package/shared/localization/locales/ca.json +72 -75
  137. package/shared/localization/locales/cs.json +89 -92
  138. package/shared/localization/locales/da.json +72 -75
  139. package/shared/localization/locales/de.json +89 -92
  140. package/shared/localization/locales/el.json +72 -75
  141. package/shared/localization/locales/en-GB.json +72 -75
  142. package/shared/localization/locales/en-US.json +75 -75
  143. package/shared/localization/locales/en-XA.json +72 -75
  144. package/shared/localization/locales/en-XL.json +75 -75
  145. package/shared/localization/locales/es-419.json +90 -93
  146. package/shared/localization/locales/es.json +90 -93
  147. package/shared/localization/locales/fi.json +72 -75
  148. package/shared/localization/locales/fil.json +72 -75
  149. package/shared/localization/locales/fr.json +89 -92
  150. package/shared/localization/locales/he.json +73 -76
  151. package/shared/localization/locales/hi.json +72 -75
  152. package/shared/localization/locales/hr.json +72 -75
  153. package/shared/localization/locales/hu.json +89 -92
  154. package/shared/localization/locales/id.json +89 -92
  155. package/shared/localization/locales/it.json +89 -92
  156. package/shared/localization/locales/ja.json +89 -92
  157. package/shared/localization/locales/ko.json +89 -92
  158. package/shared/localization/locales/lt.json +89 -92
  159. package/shared/localization/locales/lv.json +95 -98
  160. package/shared/localization/locales/nl.json +89 -92
  161. package/shared/localization/locales/no.json +72 -75
  162. package/shared/localization/locales/pl.json +72 -75
  163. package/shared/localization/locales/pt-PT.json +72 -75
  164. package/shared/localization/locales/pt.json +89 -92
  165. package/shared/localization/locales/ro.json +90 -93
  166. package/shared/localization/locales/ru.json +89 -92
  167. package/shared/localization/locales/sk.json +89 -92
  168. package/shared/localization/locales/sl.json +89 -92
  169. package/shared/localization/locales/sr-Latn.json +89 -92
  170. package/shared/localization/locales/sr.json +89 -92
  171. package/shared/localization/locales/sv.json +72 -75
  172. package/shared/localization/locales/ta.json +89 -92
  173. package/shared/localization/locales/te.json +89 -92
  174. package/shared/localization/locales/th.json +89 -92
  175. package/shared/localization/locales/tr.json +89 -92
  176. package/shared/localization/locales/uk.json +92 -95
  177. package/shared/localization/locales/vi.json +89 -92
  178. package/shared/localization/locales/zh-HK.json +89 -92
  179. package/shared/localization/locales/zh-TW.json +89 -92
  180. package/shared/localization/locales/zh.json +89 -92
  181. package/shared/localization/locales.js +6 -0
  182. package/shared/test/localization/format-test.js +45 -9
  183. package/shared/test/localization/swap-locale-test.js +0 -12
  184. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +19 -11
  185. package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
  186. package/third-party/download-content-shell/download-content-shell.js +2 -2
  187. package/third-party/download-content-shell/utils.js +0 -24
  188. package/tsconfig-all.json +2 -2
  189. package/tsconfig.json +0 -1
  190. package/types/artifacts.d.ts +7 -7
  191. package/types/enquirer.d.ts +3 -1
  192. package/types/lhr/audit-details.d.ts +6 -5
  193. package/types/lhr/flow.d.ts +3 -2
  194. package/types/lhr/lhr.d.ts +1 -1
  195. package/types/node.d.ts +5 -5
  196. package/types/rollup-plugin-postprocess.d.ts +10 -0
  197. package/changelog.md +0 -5490
  198. package/lighthouse-core/audits/dobetterweb/appcache-manifest.js +0 -67
  199. package/lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js +0 -96
  200. package/lighthouse-core/audits/redirects-http.js +0 -59
  201. package/lighthouse-core/gather/gatherers/dobetterweb/appcache.js +0 -34
  202. package/lighthouse-core/gather/gatherers/http-redirect.js +0 -46
  203. package/lighthouse-core/lib/i18n/locales/en-US.ctc.json +0 -6699
  204. package/lighthouse-core/lib/i18n/locales/en-XL.ctc.json +0 -6672
  205. package/lighthouse-core/scripts/package.json +0 -4
  206. package/report/clients/psi.js +0 -158
  207. package/report/test/clients/psi-test.js +0 -143
  208. package/shared/localization/locales/en-US.ctc.json +0 -6877
  209. package/shared/localization/locales/en-XL.ctc.json +0 -6852
@@ -3,7 +3,7 @@
3
3
  "message": "所有报告"
4
4
  },
5
5
  "flow-report/src/i18n/ui-strings.js | categories": {
6
- "message": "Categories"
6
+ "message": "类别"
7
7
  },
8
8
  "flow-report/src/i18n/ui-strings.js | categoryAccessibility": {
9
9
  "message": "无障碍"
@@ -24,40 +24,46 @@
24
24
  "message": "桌面版"
25
25
  },
26
26
  "flow-report/src/i18n/ui-strings.js | helpDialogTitle": {
27
- "message": "Understanding the Lighthouse Flow Report"
27
+ "message": "了解 Lighthouse 流程报告"
28
28
  },
29
29
  "flow-report/src/i18n/ui-strings.js | helpLabel": {
30
- "message": "Understanding Flows"
30
+ "message": "了解流程"
31
31
  },
32
32
  "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionNavigation": {
33
- "message": "Use Navigation reports to..."
33
+ "message": "使用导航报告可以…"
34
34
  },
35
35
  "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionSnapshot": {
36
- "message": "Use Snapshot reports to..."
36
+ "message": "使用快照报告可以…"
37
37
  },
38
38
  "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionTimespan": {
39
- "message": "Use Timespan reports to..."
39
+ "message": "使用时间跨度报告可以…"
40
40
  },
41
41
  "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation1": {
42
- "message": "Obtain a Lighthouse Performance score."
42
+ "message": "获取 Lighthouse 给出的性能得分。"
43
43
  },
44
44
  "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation2": {
45
- "message": "Measure page load Performance metrics such as Largest Contentful Paint and Speed Index."
45
+ "message": "衡量网页加载性能指标,例如 Largest Contentful Paint Speed Index"
46
46
  },
47
47
  "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation3": {
48
- "message": "Assess Progressive Web App capabilities."
48
+ "message": "评估渐进式 Web 应用的功能。"
49
49
  },
50
50
  "flow-report/src/i18n/ui-strings.js | helpUseCaseSnapshot1": {
51
- "message": "Find accessibility issues in single page applications or complex forms."
51
+ "message": "查找单页应用或复杂表单中的无障碍功能方面的问题。"
52
52
  },
53
53
  "flow-report/src/i18n/ui-strings.js | helpUseCaseSnapshot2": {
54
- "message": "Evaluate best practices of menus and UI elements hidden behind interaction."
54
+ "message": "评估互动背后隐藏的菜单和界面元素的最佳做法。"
55
55
  },
56
56
  "flow-report/src/i18n/ui-strings.js | helpUseCaseTimespan1": {
57
- "message": "Measure layout shifts and JavaScript execution time on a series of interactions."
57
+ "message": "衡量一系列互动的布局偏移和 JavaScript 执行用时。"
58
58
  },
59
59
  "flow-report/src/i18n/ui-strings.js | helpUseCaseTimespan2": {
60
- "message": "Discover performance opportunities to improve the experience for long-lived pages and single-page applications."
60
+ "message": "发掘性能提升机会,以便改进长期网页和单页应用的用户体验。"
61
+ },
62
+ "flow-report/src/i18n/ui-strings.js | highestImpact": {
63
+ "message": "影响力最大"
64
+ },
65
+ "flow-report/src/i18n/ui-strings.js | informativeAuditCount": {
66
+ "message": "{numInformative,plural, =1{{numInformative} 项参考性评估}other{{numInformative} 项参考性评估}}"
61
67
  },
62
68
  "flow-report/src/i18n/ui-strings.js | mobile": {
63
69
  "message": "移动版"
@@ -66,11 +72,20 @@
66
72
  "message": "网页加载"
67
73
  },
68
74
  "flow-report/src/i18n/ui-strings.js | navigationLongDescription": {
69
- "message": "Navigation reports analyze a single page load, exactly like the original Lighthouse reports."
75
+ "message": "导航报告旨在分析单个网页的加载情况,与最初的 Lighthouse 报告完全一样。"
70
76
  },
71
77
  "flow-report/src/i18n/ui-strings.js | navigationReport": {
72
78
  "message": "导航报告"
73
79
  },
80
+ "flow-report/src/i18n/ui-strings.js | navigationReportCount": {
81
+ "message": "{numNavigation,plural, =1{{numNavigation} 份导航报告}other{{numNavigation} 份导航报告}}"
82
+ },
83
+ "flow-report/src/i18n/ui-strings.js | passableAuditCount": {
84
+ "message": "{numPassableAudits,plural, =1{{numPassableAudits} 项有望通过的评估}other{{numPassableAudits} 项有望通过的评估}}"
85
+ },
86
+ "flow-report/src/i18n/ui-strings.js | passedAuditCount": {
87
+ "message": "{numPassed,plural, =1{通过了 {numPassed} 项评估}other{通过了 {numPassed} 项评估}}"
88
+ },
74
89
  "flow-report/src/i18n/ui-strings.js | ratingAverage": {
75
90
  "message": "一般"
76
91
  },
@@ -84,17 +99,20 @@
84
99
  "message": "良好"
85
100
  },
86
101
  "flow-report/src/i18n/ui-strings.js | save": {
87
- "message": "Save"
102
+ "message": "保存"
88
103
  },
89
104
  "flow-report/src/i18n/ui-strings.js | snapshotDescription": {
90
105
  "message": "捕获到的网页状态"
91
106
  },
92
107
  "flow-report/src/i18n/ui-strings.js | snapshotLongDescription": {
93
- "message": "Snapshot reports analyze the page in a particular state, typically after user interactions."
108
+ "message": "快照报告旨在分析处于特定状态的网页(通常是在用户互动之后)。"
94
109
  },
95
110
  "flow-report/src/i18n/ui-strings.js | snapshotReport": {
96
111
  "message": "快照报告"
97
112
  },
113
+ "flow-report/src/i18n/ui-strings.js | snapshotReportCount": {
114
+ "message": "{numSnapshot,plural, =1{{numSnapshot} 份快照报告}other{{numSnapshot} 份快照报告}}"
115
+ },
98
116
  "flow-report/src/i18n/ui-strings.js | summary": {
99
117
  "message": "摘要"
100
118
  },
@@ -102,11 +120,14 @@
102
120
  "message": "用户互动"
103
121
  },
104
122
  "flow-report/src/i18n/ui-strings.js | timespanLongDescription": {
105
- "message": "Timespan reports analyze an arbitrary period of time, typically containing user interactions."
123
+ "message": "时间跨度报告旨在分析任意时间段(通常包含用户互动)。"
106
124
  },
107
125
  "flow-report/src/i18n/ui-strings.js | timespanReport": {
108
126
  "message": "时间跨度报告"
109
127
  },
128
+ "flow-report/src/i18n/ui-strings.js | timespanReportCount": {
129
+ "message": "{numTimespan,plural, =1{{numTimespan} 份时间跨度报告}other{{numTimespan} 份时间跨度报告}}"
130
+ },
110
131
  "flow-report/src/i18n/ui-strings.js | title": {
111
132
  "message": "Lighthouse 用户流报告"
112
133
  },
@@ -743,18 +764,6 @@
743
764
  "lighthouse-core/audits/deprecations.js | title": {
744
765
  "message": "请勿使用已弃用的 API"
745
766
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "应用缓存已被弃用。[了解详情](https://web.dev/appcache-manifest/)。"
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "发现了“{AppCacheManifest}”"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "使用了应用缓存"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "请勿使用应用缓存"
757
- },
758
767
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
768
  "message": "必须声明字符编码。您可以在 HTML 的前 1024 个字节中使用 `<meta>` 标记来声明,也可以在 HTTP 响应标头 Content-Type 中进行声明。[了解详情](https://web.dev/charset/)。"
760
769
  },
@@ -812,21 +821,6 @@
812
821
  "lighthouse-core/audits/dobetterweb/dom-size.js | title": {
813
822
  "message": "避免 DOM 规模过大"
814
823
  },
815
- "lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | columnFailingAnchors": {
816
- "message": "未通过审核的锚点"
817
- },
818
- "lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | description": {
819
- "message": "向任何外部链接添加 `rel=\"noopener\"` 或 `rel=\"noreferrer\"`,可提高性能并减少安全漏洞。[了解详情](https://web.dev/external-anchors-use-rel-noopener/)。"
820
- },
821
- "lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | failureTitle": {
822
- "message": "指向跨域目的地的链接不安全"
823
- },
824
- "lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | title": {
825
- "message": "指向跨域目的地的链接安全"
826
- },
827
- "lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | warning": {
828
- "message": "无法确定锚点 ({anchorHTML}) 的目的地。如果不用作超链接,建议移除 target=_blank。"
829
- },
830
824
  "lighthouse-core/audits/dobetterweb/geolocation-on-start.js | description": {
831
825
  "message": "如果网站在缺少上下文的情况下请求位置,会导致用户不信任网站或感到困惑。建议将请求与用户操作进行绑定。[了解详情](https://web.dev/geolocation-on-start/)。"
832
826
  },
@@ -1277,15 +1271,6 @@
1277
1271
  "lighthouse-core/audits/preload-lcp-image.js | title": {
1278
1272
  "message": "预加载 LCP 元素所用图片"
1279
1273
  },
1280
- "lighthouse-core/audits/redirects-http.js | description": {
1281
- "message": "如果您已设置 HTTPS,请确保将所有 HTTP 流量重定向到 HTTPS,以便让所有用户都能使用安全的网络功能。[了解详情](https://web.dev/redirects-http/)。"
1282
- },
1283
- "lighthouse-core/audits/redirects-http.js | failureTitle": {
1284
- "message": "未将 HTTP 流量重定向到 HTTPS"
1285
- },
1286
- "lighthouse-core/audits/redirects-http.js | title": {
1287
- "message": "将 HTTP 流量重定向到 HTTPS"
1288
- },
1289
1274
  "lighthouse-core/audits/redirects.js | description": {
1290
1275
  "message": "重定向会在网页可加载前引入更多延迟。[了解详情](https://web.dev/redirects/)。"
1291
1276
  },
@@ -1776,7 +1761,7 @@
1776
1761
  "message": "基准 [PWA 核对清单](https://developers.google.com/web/progressive-web-apps/checklist)要求必须进行此类检查,但 Lighthouse 不会自动进行此类检查。它们不会影响您的得分,但您必须手动对其进行验证。"
1777
1762
  },
1778
1763
  "lighthouse-core/config/default-config.js | pwaCategoryTitle": {
1779
- "message": "渐进式 Web 应用"
1764
+ "message": "PWA"
1780
1765
  },
1781
1766
  "lighthouse-core/config/default-config.js | pwaInstallableGroupTitle": {
1782
1767
  "message": "可安装"
@@ -2078,30 +2063,6 @@
2078
2063
  "lighthouse-core/lib/lh-error.js | urlInvalid": {
2079
2064
  "message": "您提供的网址似乎无效。"
2080
2065
  },
2081
- "lighthouse-treemap/app/src/util.js | allLabel": {
2082
- "message": "全部"
2083
- },
2084
- "lighthouse-treemap/app/src/util.js | allScriptsDropdownLabel": {
2085
- "message": "所有脚本"
2086
- },
2087
- "lighthouse-treemap/app/src/util.js | coverageColumnName": {
2088
- "message": "覆盖率"
2089
- },
2090
- "lighthouse-treemap/app/src/util.js | duplicateModulesLabel": {
2091
- "message": "重复的模块"
2092
- },
2093
- "lighthouse-treemap/app/src/util.js | resourceBytesLabel": {
2094
- "message": "资源字节数"
2095
- },
2096
- "lighthouse-treemap/app/src/util.js | tableColumnName": {
2097
- "message": "名称"
2098
- },
2099
- "lighthouse-treemap/app/src/util.js | toggleTableButtonLabel": {
2100
- "message": "显示/隐藏表格"
2101
- },
2102
- "lighthouse-treemap/app/src/util.js | unusedBytesLabel": {
2103
- "message": "未使用的字节数"
2104
- },
2105
2066
  "node_modules/lighthouse-stack-packs/packs/amp.js | efficient-animated-content": {
2106
2067
  "message": "对于动画内容,请使用 [`amp-anim`](https://amp.dev/documentation/components/amp-anim/) 尽量减少当内容在屏幕外时的 CPU 使用量。"
2107
2068
  },
@@ -2369,6 +2330,9 @@
2369
2330
  "report/renderer/util.js | calculatorLink": {
2370
2331
  "message": "查看计算器。"
2371
2332
  },
2333
+ "report/renderer/util.js | collapseView": {
2334
+ "message": "收起视图"
2335
+ },
2372
2336
  "report/renderer/util.js | crcInitialNavigation": {
2373
2337
  "message": "初始导航"
2374
2338
  },
@@ -2405,9 +2369,15 @@
2405
2369
  "report/renderer/util.js | errorMissingAuditInfo": {
2406
2370
  "message": "报告错误:没有任何审核信息"
2407
2371
  },
2372
+ "report/renderer/util.js | expandView": {
2373
+ "message": "展开视图"
2374
+ },
2408
2375
  "report/renderer/util.js | footerIssue": {
2409
2376
  "message": "提交问题"
2410
2377
  },
2378
+ "report/renderer/util.js | hide": {
2379
+ "message": "隐藏"
2380
+ },
2411
2381
  "report/renderer/util.js | labDataTitle": {
2412
2382
  "message": "实验室数据"
2413
2383
  },
@@ -2429,6 +2399,12 @@
2429
2399
  "report/renderer/util.js | passedAuditsGroupTitle": {
2430
2400
  "message": "已通过的审核"
2431
2401
  },
2402
+ "report/renderer/util.js | runtimeAnalysisWindow": {
2403
+ "message": "初始网页加载"
2404
+ },
2405
+ "report/renderer/util.js | runtimeCustom": {
2406
+ "message": "自定义节流"
2407
+ },
2432
2408
  "report/renderer/util.js | runtimeDesktopEmulation": {
2433
2409
  "message": "模拟桌面设备"
2434
2410
  },
@@ -2447,33 +2423,30 @@
2447
2423
  "report/renderer/util.js | runtimeSettingsCPUThrottling": {
2448
2424
  "message": "CPU 节流"
2449
2425
  },
2450
- "report/renderer/util.js | runtimeSettingsChannel": {
2451
- "message": "所用工具"
2452
- },
2453
2426
  "report/renderer/util.js | runtimeSettingsDevice": {
2454
2427
  "message": "设备"
2455
2428
  },
2456
- "report/renderer/util.js | runtimeSettingsFetchTime": {
2457
- "message": "提取时间"
2458
- },
2459
2429
  "report/renderer/util.js | runtimeSettingsNetworkThrottling": {
2460
2430
  "message": "网络节流"
2461
2431
  },
2462
- "report/renderer/util.js | runtimeSettingsTitle": {
2463
- "message": "运行时设置"
2464
- },
2465
- "report/renderer/util.js | runtimeSettingsUA": {
2466
- "message": "用户代理(主机)"
2467
- },
2468
2432
  "report/renderer/util.js | runtimeSettingsUANetwork": {
2469
2433
  "message": "用户代理(网络)"
2470
2434
  },
2471
- "report/renderer/util.js | runtimeSettingsUrl": {
2472
- "message": "网址"
2435
+ "report/renderer/util.js | runtimeSingleLoad": {
2436
+ "message": "单次网页加载"
2437
+ },
2438
+ "report/renderer/util.js | runtimeSingleLoadTooltip": {
2439
+ "message": "此数据是取自单次网页加载,现场数据则是汇总了许多次网页加载。"
2440
+ },
2441
+ "report/renderer/util.js | runtimeSlow4g": {
2442
+ "message": "低速 4G 节流"
2473
2443
  },
2474
2444
  "report/renderer/util.js | runtimeUnknown": {
2475
2445
  "message": "不明"
2476
2446
  },
2447
+ "report/renderer/util.js | show": {
2448
+ "message": "显示"
2449
+ },
2477
2450
  "report/renderer/util.js | showRelevantAudits": {
2478
2451
  "message": "显示与所选指标相关的评估结果:"
2479
2452
  },
@@ -2503,5 +2476,29 @@
2503
2476
  },
2504
2477
  "report/renderer/util.js | warningHeader": {
2505
2478
  "message": "警告: "
2479
+ },
2480
+ "treemap/app/src/util.js | allLabel": {
2481
+ "message": "全部"
2482
+ },
2483
+ "treemap/app/src/util.js | allScriptsDropdownLabel": {
2484
+ "message": "所有脚本"
2485
+ },
2486
+ "treemap/app/src/util.js | coverageColumnName": {
2487
+ "message": "覆盖率"
2488
+ },
2489
+ "treemap/app/src/util.js | duplicateModulesLabel": {
2490
+ "message": "重复的模块"
2491
+ },
2492
+ "treemap/app/src/util.js | resourceBytesLabel": {
2493
+ "message": "资源字节数"
2494
+ },
2495
+ "treemap/app/src/util.js | tableColumnName": {
2496
+ "message": "名称"
2497
+ },
2498
+ "treemap/app/src/util.js | toggleTableButtonLabel": {
2499
+ "message": "显示/隐藏表格"
2500
+ },
2501
+ "treemap/app/src/util.js | unusedBytesLabel": {
2502
+ "message": "未使用的字节数"
2506
2503
  }
2507
2504
  }
@@ -12,6 +12,12 @@
12
12
  * Google locale inheritance rules: https://goto.google.com/ccssm
13
13
  * CLDR language aliases: https://www.unicode.org/cldr/charts/latest/supplemental/aliases.html
14
14
  * CLDR locale inheritance: https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/parentLocales.json
15
+ *
16
+ * For Lighthouse bundles that shouldn't include locale data, the recommended pattern
17
+ * is to replace the default export of this file with `{}` so that no locale messages
18
+ * are included. Strings will work normally through the IcuMessage.formattedDefault
19
+ * fallback, and locale messages can be added on demand (e.g. dynamically fetched)
20
+ * through `format.registerLocaleData()`.
15
21
  */
16
22
 
17
23
  // TODO(paulirish): Centralize locale inheritance (combining this & i18n.lookupLocale()), adopt cldr parentLocale rules.
@@ -9,10 +9,54 @@ const path = require('path');
9
9
 
10
10
  const format = require('../../localization/format.js');
11
11
  const i18n = require('../../../lighthouse-core/lib/i18n/i18n.js');
12
+ const constants = require('../../../lighthouse-core/config/constants.js');
13
+ const locales = require('../../localization/locales.js');
12
14
 
13
15
  /* eslint-env jest */
14
16
 
15
17
  describe('format', () => {
18
+ describe('DEFAULT_LOCALE', () => {
19
+ it('is the same as the default config locale', () => {
20
+ expect(format.DEFAULT_LOCALE).toBe(constants.defaultSettings.locale);
21
+ });
22
+ });
23
+
24
+ describe('#getAvailableLocales', () => {
25
+ it('has all the available locales', () => {
26
+ const availableLocales = format.getAvailableLocales();
27
+ for (const locale of ['en', 'es', 'ru', 'zh']) {
28
+ expect(availableLocales).toContain(locale);
29
+ }
30
+
31
+ const rawLocales = Object.keys(locales).sort();
32
+ expect(availableLocales.sort()).toEqual(rawLocales);
33
+ });
34
+
35
+ it('contains the default locale', () => {
36
+ expect(format.getAvailableLocales()).toContain(format.DEFAULT_LOCALE);
37
+ });
38
+ });
39
+
40
+ describe('#getCanonicalLocales', () => {
41
+ it('contains some canonical locales', () => {
42
+ const canonicalLocales = format.getCanonicalLocales();
43
+ for (const locale of ['en-US', 'es', 'ru', 'zh']) {
44
+ expect(canonicalLocales).toContain(locale);
45
+ }
46
+ });
47
+
48
+ it('is a subset of the available locales', () => {
49
+ const canonicalLocales = format.getCanonicalLocales();
50
+ const availableLocales = format.getAvailableLocales();
51
+
52
+ for (const canonicalLocale of canonicalLocales) {
53
+ expect(availableLocales).toContain(canonicalLocale);
54
+ }
55
+
56
+ expect(canonicalLocales.length).toBeLessThan(availableLocales.length);
57
+ });
58
+ });
59
+
16
60
  describe('#_formatPathAsString', () => {
17
61
  it('handles simple paths', () => {
18
62
  expect(format._formatPathAsString(['foo'])).toBe('foo');
@@ -363,15 +407,7 @@ describe('format', () => {
363
407
  expect(helloInfinityStr).toBeDisplayString('Hello ∞ World');
364
408
 
365
409
  const helloNaNStr = str_(UIStrings.helloBytesWorld, {in: NaN});
366
- // TODO(COMPAT): workaround can be removed after Node 13 is retired.
367
- // expect(helloNaNStr).toBeDisplayString('Hello NaN World');
368
-
369
- // Node 13/V8 7.9 and 8.0 have a bug where `({a: NaN}).a.toLocaleString() === "-NaN"`. It
370
- // works correctly in Node 12 and 14, so work around it since NaN isn't essential for
371
- // user-facing strings and it will eventually correct itself.
372
- const formattedNaNStr = format.getFormatted(helloNaNStr, 'en-US');
373
- expect(formattedNaNStr === 'Hello NaN World' || formattedNaNStr === 'Hello -NaN World')
374
- .toBe(true);
410
+ expect(helloNaNStr).toBeDisplayString('Hello NaN World');
375
411
  });
376
412
  });
377
413
  });
@@ -6,23 +6,11 @@
6
6
  'use strict';
7
7
 
8
8
  const swapLocale = require('../../localization/swap-locale.js');
9
- const {isNode12SmallIcu} = require('../../../lighthouse-core/test/test-utils.js');
10
9
 
11
10
  const lhr = require('../../../lighthouse-core/test/results/sample_v2.json');
12
11
 
13
12
  /* eslint-env jest */
14
13
  describe('swap-locale', () => {
15
- // COMPAT: Node 12 only has 'en' by default. Skip these tests since they're all about swapping locales.
16
- if (isNode12SmallIcu()) {
17
- // Jest requires at least one test per suite.
18
- it('throws if locale is not supported', () => {
19
- // Even though 'pt' is requested, 'en' is all that's available.
20
- expect(() => swapLocale(lhr, 'pt')).toThrow('Unsupported locale \'pt\'');
21
- });
22
-
23
- return;
24
- }
25
-
26
14
  it('does not mutate the original lhr', () => {
27
15
  /** @type {LH.Result} */
28
16
  const lhrClone = JSON.parse(JSON.stringify(lhr));
@@ -31,18 +31,26 @@ describe('issueAdded types', () => {
31
31
  .sort();
32
32
  });
33
33
 
34
- // TODO: https://github.com/GoogleChrome/lighthouse/issues/13147
35
- it.skip('should notify us if something changed', () => {
34
+ it('should notify us if something changed', () => {
36
35
  expect(inspectorIssueDetailsTypes).toMatchInlineSnapshot(`
37
- Array [
38
- "blockedByResponseIssueDetails",
39
- "contentSecurityPolicyIssueDetails",
40
- "heavyAdIssueDetails",
41
- "mixedContentIssueDetails",
42
- "sameSiteCookieIssueDetails",
43
- "sharedArrayBufferTransferIssueDetails",
44
- ]
45
- `);
36
+ Array [
37
+ "attributionReportingIssueDetails",
38
+ "blockedByResponseIssueDetails",
39
+ "contentSecurityPolicyIssueDetails",
40
+ "corsIssueDetails",
41
+ "deprecationIssueDetails",
42
+ "genericIssueDetails",
43
+ "heavyAdIssueDetails",
44
+ "lowTextContrastIssueDetails",
45
+ "mixedContentIssueDetails",
46
+ "navigatorUserAgentIssueDetails",
47
+ "quirksModeIssueDetails",
48
+ "sameSiteCookieIssueDetails",
49
+ "sharedArrayBufferIssueDetails",
50
+ "twaQualityEnforcementDetails",
51
+ "wasmCrossOriginModuleSharingIssue",
52
+ ]
53
+ `);
46
54
  });
47
55
 
48
56
  // TODO: https://github.com/GoogleChrome/lighthouse/issues/13147
@@ -11,6 +11,8 @@ const InstallableManifestAudit = require('../../lighthouse-core/audits/installab
11
11
 
12
12
  /* eslint-env jest */
13
13
 
14
+ jest.setTimeout(20_000);
15
+
14
16
  describe('installabilityErrors', () => {
15
17
  let chromiumErrorIds;
16
18
 
@@ -85,7 +85,7 @@ function deleteOldContentShells() {
85
85
  const remainingNumberOfContentShells = MAX_CONTENT_SHELLS / 2;
86
86
  const oldContentShellDirs = files.slice(remainingNumberOfContentShells);
87
87
  for (let i = 0; i < oldContentShellDirs.length; i++) {
88
- utils.removeRecursive(path.resolve(CACHE_PATH, oldContentShellDirs[i]));
88
+ fs.rmSync(path.resolve(CACHE_PATH, oldContentShellDirs[i]), {recursive: true, force: true});
89
89
  }
90
90
  console.log(`Removed old content shells: ${oldContentShellDirs}`);
91
91
  }
@@ -126,7 +126,7 @@ function findPreviousUploadedPosition(commitPosition) {
126
126
  async function prepareContentShellDirectory(folder) {
127
127
  const contentShellPath = path.join(CACHE_PATH, folder);
128
128
  if (utils.isDir(contentShellPath)) {
129
- utils.removeRecursive(contentShellPath);
129
+ fs.rmSync(contentShellPath, {recursive: true, force: true});
130
130
  }
131
131
  fs.mkdirSync(contentShellPath);
132
132
  return folder;
@@ -96,29 +96,6 @@ function copyRecursive(src, dest) {
96
96
  }
97
97
  }
98
98
 
99
- function removeRecursive(filePath) {
100
- try {
101
- if (fs.existsSync(filePath)) {
102
- if (isFile(filePath)) {
103
- fs.unlinkSync(filePath);
104
- return;
105
- }
106
- const files = fs.readdirSync(filePath);
107
- for (let i = 0; i < files.length; i++) {
108
- const childPath = path.resolve(filePath, files[i]);
109
- if (isDir(childPath)) {
110
- removeRecursive(childPath);
111
- } else {
112
- fs.unlinkSync(childPath);
113
- }
114
- }
115
- fs.rmdirSync(filePath);
116
- }
117
- } catch (error) {
118
- throw new Error(`Received an error: [${error}] while trying to remove: ${filePath}`);
119
- }
120
- }
121
-
122
99
  function includes(sequence, target) {
123
100
  return sequence.indexOf(target) > -1;
124
101
  }
@@ -145,7 +122,6 @@ module.exports = {
145
122
  isDir,
146
123
  copy,
147
124
  copyRecursive,
148
- removeRecursive,
149
125
  includes,
150
126
  shellOutput,
151
127
  parseArgs,
package/tsconfig-all.json CHANGED
@@ -6,8 +6,8 @@
6
6
  {"path": "./types/lhr/"},
7
7
  {"path": "./report/"},
8
8
  {"path": "./report/generator/"},
9
- {"path": "./lighthouse-viewer/"},
10
- {"path": "./lighthouse-treemap/"},
9
+ {"path": "./viewer/"},
10
+ {"path": "./treemap/"},
11
11
  {"path": "./flow-report/"},
12
12
  {"path": "./shared/"},
13
13
  ],
package/tsconfig.json CHANGED
@@ -58,7 +58,6 @@
58
58
  "lighthouse-core/test/gather/gatherers/full-page-screenshot-test.js",
59
59
  "lighthouse-core/test/gather/gatherers/global-listeners-test.js",
60
60
  "lighthouse-core/test/gather/gatherers/html-without-javascript-test.js",
61
- "lighthouse-core/test/gather/gatherers/http-redirect-test.js",
62
61
  "lighthouse-core/test/gather/gatherers/js-usage-test.js",
63
62
  "lighthouse-core/test/gather/gatherers/link-elements-test.js",
64
63
  "lighthouse-core/test/gather/gatherers/offline-test.js",
@@ -25,7 +25,6 @@ export interface Artifacts extends BaseArtifacts, GathererArtifacts {}
25
25
 
26
26
  export type FRArtifacts = StrictOmit<Artifacts,
27
27
  | 'Fonts'
28
- | 'HTTPRedirect'
29
28
  | 'Manifest'
30
29
  | 'MixedContent'
31
30
  | keyof FRBaseArtifacts
@@ -123,8 +122,6 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
123
122
  Accessibility: Artifacts.Accessibility;
124
123
  /** Array of all anchors on the page. */
125
124
  AnchorElements: Artifacts.AnchorElement[];
126
- /** The value of the page's <html> manifest attribute, or null if not defined */
127
- AppCacheManifest: string | null;
128
125
  /** Array of all URLs cached in CacheStorage. */
129
126
  CacheContents: string[];
130
127
  /** CSS coverage information for styles used by page's final state. */
@@ -148,8 +145,6 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
148
145
  FullPageScreenshot: Artifacts.FullPageScreenshot | null;
149
146
  /** Information about event listeners registered on the global object. */
150
147
  GlobalListeners: Array<Artifacts.GlobalListener>;
151
- /** Whether the page ended up on an HTTPS page after attempting to load the HTTP version. */
152
- HTTPRedirect: {value: boolean};
153
148
  /** The issues surfaced in the devtools Issues panel */
154
149
  InspectorIssues: Artifacts.InspectorIssues;
155
150
  /** JS coverage information for code used during page load. Keyed by network URL. */
@@ -211,6 +206,7 @@ declare module Artifacts {
211
206
  target: Array<string>;
212
207
  failureSummary?: string;
213
208
  node: NodeDetails;
209
+ relatedNodes: NodeDetails[];
214
210
  }>;
215
211
  error?: RuleExecutionError;
216
212
  }
@@ -491,8 +487,6 @@ declare module Artifacts {
491
487
  isPicture: boolean;
492
488
  /** Flags whether this element was contained within a ShadowRoot */
493
489
  isInShadowDOM: boolean;
494
- /** The MIME type of the underlying image file. */
495
- mimeType?: string;
496
490
  /** Details for node in DOM for the image element */
497
491
  node: NodeDetails;
498
492
  /** The loading attribute of the image. */
@@ -564,6 +558,7 @@ declare module Artifacts {
564
558
  blockedByResponse: LH.Crdp.Audits.BlockedByResponseIssueDetails[];
565
559
  heavyAds: LH.Crdp.Audits.HeavyAdIssueDetails[];
566
560
  contentSecurityPolicy: LH.Crdp.Audits.ContentSecurityPolicyIssueDetails[];
561
+ deprecations: LH.Crdp.Audits.DeprecationIssueDetails[];
567
562
  }
568
563
 
569
564
  // Computed artifact types below.
@@ -875,6 +870,11 @@ declare module Artifacts {
875
870
  }
876
871
 
877
872
  type ConsoleMessage = ConsoleAPICall | ConsoleException | ConsoleProtocolLog;
873
+
874
+ interface ImageElementRecord extends ImageElement {
875
+ /** The MIME type of the underlying image file. */
876
+ mimeType?: string;
877
+ }
878
878
  }
879
879
 
880
880
  export interface Trace {
@@ -4,6 +4,8 @@
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
6
 
7
+ import {EventEmitter} from 'events';
8
+
7
9
  declare module 'enquirer' {
8
10
  interface ConfirmOption {
9
11
  name: string | (() => string);
@@ -12,7 +14,7 @@ declare module 'enquirer' {
12
14
  actions?: {'ctrl': {[key: string]: string}}
13
15
  }
14
16
 
15
- class Confirm extends NodeJS.EventEmitter {
17
+ class Confirm extends EventEmitter {
16
18
  constructor(option: ConfirmOption);
17
19
  run: () => Promise<boolean>;
18
20
  close: () => Promise<void>