lighthouse 8.5.1-dev.20211012 → 8.5.1

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 (172) hide show
  1. package/dist/report/flow.js +149 -0
  2. package/dist/report/standalone.js +228 -0
  3. package/flow-report/assets/styles.css +9 -272
  4. package/flow-report/jest.config.js +1 -1
  5. package/flow-report/src/app.tsx +9 -31
  6. package/flow-report/src/common.tsx +7 -86
  7. package/flow-report/src/icons.tsx +3 -20
  8. package/flow-report/src/sidebar/sidebar.tsx +16 -11
  9. package/flow-report/src/summary/category.tsx +24 -42
  10. package/flow-report/src/summary/summary.tsx +29 -32
  11. package/flow-report/src/topbar.tsx +4 -54
  12. package/flow-report/src/util.ts +1 -26
  13. package/flow-report/src/wrappers/report-renderer.tsx +1 -1
  14. package/flow-report/src/wrappers/report.tsx +21 -6
  15. package/flow-report/test/app-test.tsx +13 -17
  16. package/flow-report/test/setup/env-setup.ts +0 -1
  17. package/flow-report/test/sidebar/flow-test.tsx +12 -6
  18. package/flow-report/test/sidebar/sidebar-test.tsx +13 -7
  19. package/flow-report/test/summary/category-test.tsx +34 -79
  20. package/flow-report/test/summary/summary-test.tsx +17 -11
  21. package/flow-report/test/util-test.tsx +12 -1
  22. package/flow-report/tsconfig.json +0 -1
  23. package/flow-report/types/flow-report.d.ts +1 -2
  24. package/jest.config.js +15 -1
  25. package/lighthouse-cli/bin.js +0 -5
  26. package/lighthouse-cli/cli-flags.js +3 -10
  27. package/lighthouse-cli/commands/commands.js +0 -1
  28. package/lighthouse-cli/run.js +2 -2
  29. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
  30. package/lighthouse-cli/test/smokehouse/report-assert.js +4 -20
  31. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +1 -2
  32. package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
  33. package/lighthouse-core/audits/seo/crawlable-anchors.js +12 -10
  34. package/lighthouse-core/computed/js-bundles.js +2 -1
  35. package/lighthouse-core/computed/unused-javascript-summary.js +3 -3
  36. package/lighthouse-core/config/config.js +2 -2
  37. package/lighthouse-core/config/default-config.js +0 -5
  38. package/lighthouse-core/fraggle-rock/api.js +0 -10
  39. package/lighthouse-core/fraggle-rock/config/filters.js +3 -22
  40. package/lighthouse-core/fraggle-rock/gather/driver.js +0 -4
  41. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -2
  42. package/lighthouse-core/fraggle-rock/user-flow.js +6 -35
  43. package/lighthouse-core/gather/driver/navigation.js +0 -5
  44. package/lighthouse-core/gather/driver/prepare.js +0 -14
  45. package/lighthouse-core/gather/driver/storage.js +0 -5
  46. package/lighthouse-core/gather/gather-runner.js +2 -2
  47. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -5
  48. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +24 -30
  49. package/{shared/localization/i18n-module.js → lighthouse-core/lib/cdt/Common.js} +8 -3
  50. package/lighthouse-core/lib/cdt/SDK.js +123 -3
  51. package/lighthouse-core/lib/cdt/generated/SourceMap.js +312 -148
  52. package/lighthouse-core/lib/csp-evaluator.js +1 -2
  53. package/lighthouse-core/lib/i18n/README.md +6 -6
  54. package/lighthouse-core/lib/i18n/i18n.js +342 -9
  55. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ar-XB.json +0 -0
  56. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ar.json +0 -0
  57. package/{shared/localization → lighthouse-core/lib/i18n}/locales/bg.json +0 -0
  58. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ca.json +0 -0
  59. package/{shared/localization → lighthouse-core/lib/i18n}/locales/cs.json +0 -0
  60. package/{shared/localization → lighthouse-core/lib/i18n}/locales/da.json +0 -0
  61. package/{shared/localization → lighthouse-core/lib/i18n}/locales/de.json +0 -0
  62. package/{shared/localization → lighthouse-core/lib/i18n}/locales/el.json +0 -0
  63. package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-GB.json +0 -0
  64. package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-US.json +0 -111
  65. package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-XA.json +0 -0
  66. package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-XL.json +0 -111
  67. package/{shared/localization → lighthouse-core/lib/i18n}/locales/es-419.json +0 -0
  68. package/{shared/localization → lighthouse-core/lib/i18n}/locales/es.json +0 -0
  69. package/{shared/localization → lighthouse-core/lib/i18n}/locales/fi.json +0 -0
  70. package/{shared/localization → lighthouse-core/lib/i18n}/locales/fil.json +0 -0
  71. package/{shared/localization → lighthouse-core/lib/i18n}/locales/fr.json +0 -0
  72. package/{shared/localization → lighthouse-core/lib/i18n}/locales/he.json +0 -0
  73. package/{shared/localization → lighthouse-core/lib/i18n}/locales/hi.json +0 -0
  74. package/{shared/localization → lighthouse-core/lib/i18n}/locales/hr.json +0 -0
  75. package/{shared/localization → lighthouse-core/lib/i18n}/locales/hu.json +0 -0
  76. package/{shared/localization → lighthouse-core/lib/i18n}/locales/id.json +0 -0
  77. package/{shared/localization → lighthouse-core/lib/i18n}/locales/it.json +0 -0
  78. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ja.json +0 -0
  79. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ko.json +0 -0
  80. package/{shared/localization → lighthouse-core/lib/i18n}/locales/lt.json +0 -0
  81. package/{shared/localization → lighthouse-core/lib/i18n}/locales/lv.json +0 -0
  82. package/{shared/localization → lighthouse-core/lib/i18n}/locales/nl.json +0 -0
  83. package/{shared/localization → lighthouse-core/lib/i18n}/locales/no.json +0 -0
  84. package/{shared/localization → lighthouse-core/lib/i18n}/locales/pl.json +0 -0
  85. package/{shared/localization → lighthouse-core/lib/i18n}/locales/pt-PT.json +0 -0
  86. package/{shared/localization → lighthouse-core/lib/i18n}/locales/pt.json +0 -0
  87. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ro.json +0 -0
  88. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ru.json +0 -0
  89. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sk.json +0 -0
  90. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sl.json +0 -0
  91. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sr-Latn.json +0 -0
  92. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sr.json +0 -0
  93. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sv.json +0 -0
  94. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ta.json +0 -0
  95. package/{shared/localization → lighthouse-core/lib/i18n}/locales/te.json +0 -0
  96. package/{shared/localization → lighthouse-core/lib/i18n}/locales/th.json +0 -0
  97. package/{shared/localization → lighthouse-core/lib/i18n}/locales/tr.json +0 -0
  98. package/{shared/localization → lighthouse-core/lib/i18n}/locales/uk.json +0 -0
  99. package/{shared/localization → lighthouse-core/lib/i18n}/locales/vi.json +0 -0
  100. package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh-HK.json +0 -0
  101. package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh-TW.json +0 -0
  102. package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh.json +0 -0
  103. package/{shared/localization → lighthouse-core/lib/i18n}/locales.js +1 -2
  104. package/{shared/localization → lighthouse-core/lib/i18n}/swap-locale.js +7 -9
  105. package/lighthouse-core/lib/page-functions.js +4 -4
  106. package/lighthouse-core/lib/stack-packs.js +13 -1
  107. package/{shared → lighthouse-core/lib}/type-verifiers.js +0 -0
  108. package/lighthouse-core/runner.js +6 -6
  109. package/lighthouse-core/scripts/manual-chrome-launcher.js +1 -4
  110. package/lighthouse-core/util-commonjs.js +4 -20
  111. package/package.json +16 -19
  112. package/readme.md +1 -1
  113. package/report/assets/standalone-template.html +1 -0
  114. package/report/assets/styles.css +41 -16
  115. package/report/assets/templates.html +4 -42
  116. package/report/clients/psi.js +0 -1
  117. package/report/clients/standalone.js +2 -1
  118. package/report/generator/file-namer.js +8 -17
  119. package/report/generator/report-generator.js +1 -0
  120. package/report/renderer/category-renderer.js +16 -4
  121. package/report/renderer/components.js +71 -107
  122. package/report/renderer/dom.js +0 -19
  123. package/report/renderer/logger.js +2 -35
  124. package/report/renderer/performance-category-renderer.js +21 -23
  125. package/report/renderer/pwa-category-renderer.js +2 -1
  126. package/report/renderer/report-renderer.js +0 -21
  127. package/report/renderer/report-ui-features.js +19 -7
  128. package/report/renderer/util.js +4 -20
  129. package/report/test/clients/psi-test.js +4 -0
  130. package/report/test/generator/file-namer-test.js +2 -2
  131. package/report/test/renderer/category-renderer-test.js +1 -1
  132. package/report/test/renderer/performance-category-renderer-test.js +0 -12
  133. package/report/test/renderer/report-renderer-test.js +55 -0
  134. package/report/test/renderer/util-test.js +8 -68
  135. package/report/test-assets/faux-psi-template.html +1 -0
  136. package/report/tsconfig.json +1 -2
  137. package/report/types/html-renderer.d.ts +1 -2
  138. package/root.js +0 -18
  139. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +3 -5
  140. package/third-party/chromium-synchronization/installability-errors-test.js +1 -2
  141. package/tsconfig-all.json +0 -1
  142. package/tsconfig-base.json +1 -1
  143. package/tsconfig.json +3 -2
  144. package/types/config.d.ts +0 -1
  145. package/types/externs.d.ts +0 -2
  146. package/types/lhr/flow.d.ts +0 -7
  147. package/types/lhr/i18n.d.ts +3 -0
  148. package/changelog.md +0 -5395
  149. package/flow-report/.eslintrc.cjs +0 -49
  150. package/flow-report/package.json +0 -4
  151. package/flow-report/src/header.tsx +0 -88
  152. package/flow-report/src/help-dialog.tsx +0 -120
  153. package/flow-report/src/i18n/i18n.tsx +0 -44
  154. package/flow-report/src/i18n/localized-strings.js +0 -11
  155. package/flow-report/src/i18n/ui-strings.js +0 -86
  156. package/flow-report/test/common-test.tsx +0 -89
  157. package/flow-report/test/header-test.tsx +0 -55
  158. package/flow-report/test/sample-flow.ts +0 -17
  159. package/flow-report/test/topbar-test.tsx +0 -68
  160. package/lighthouse-cli/commands/list-locales.js +0 -16
  161. package/lighthouse-core/lib/cdt/Platform.js +0 -55
  162. package/lighthouse-core/scripts/package.json +0 -4
  163. package/report/renderer/swap-locale-feature.js +0 -82
  164. package/report/test/renderer/report-renderer-axe-test.js +0 -86
  165. package/shared/localization/format.js +0 -422
  166. package/shared/localization/swap-flow-locale.js +0 -20
  167. package/shared/test/localization/format-test.js +0 -377
  168. package/shared/test/localization/locales-test.js +0 -47
  169. package/shared/test/localization/swap-locale-test.js +0 -140
  170. package/shared/tsconfig.json +0 -22
  171. package/shared/types/shared.d.ts +0 -24
  172. package/types/es-main.d.ts +0 -18
@@ -1,115 +1,4 @@
1
1
  {
2
- "flow-report/src/i18n/ui-strings.js | allReports": {
3
- "message": "Âĺl̂ Ŕêṕôŕt̂ś"
4
- },
5
- "flow-report/src/i18n/ui-strings.js | categories": {
6
- "message": "Ĉát̂éĝór̂íêś"
7
- },
8
- "flow-report/src/i18n/ui-strings.js | categoryAccessibility": {
9
- "message": "Âćĉéŝśîb́îĺît́ŷ"
10
- },
11
- "flow-report/src/i18n/ui-strings.js | categoryBestPractices": {
12
- "message": "B̂éŝt́ P̂ŕâćt̂íĉéŝ"
13
- },
14
- "flow-report/src/i18n/ui-strings.js | categoryPerformance": {
15
- "message": "P̂ér̂f́ôŕm̂án̂ćê"
16
- },
17
- "flow-report/src/i18n/ui-strings.js | categoryProgressiveWebApp": {
18
- "message": "P̂ŕôǵr̂éŝśîv́ê Ẃêb́ Âṕp̂"
19
- },
20
- "flow-report/src/i18n/ui-strings.js | categorySeo": {
21
- "message": "ŜÉÔ"
22
- },
23
- "flow-report/src/i18n/ui-strings.js | desktop": {
24
- "message": "D̂éŝḱt̂óp̂"
25
- },
26
- "flow-report/src/i18n/ui-strings.js | helpDialogTitle": {
27
- "message": "Ûńd̂ér̂śt̂án̂d́îńĝ t́ĥé L̂íĝh́t̂h́ôúŝé F̂ĺôẃ R̂ép̂ór̂t́"
28
- },
29
- "flow-report/src/i18n/ui-strings.js | helpLabel": {
30
- "message": "Ûńd̂ér̂śt̂án̂d́îńĝ F́l̂óŵś"
31
- },
32
- "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionNavigation": {
33
- "message": "Ûśê Ńâv́îǵât́îón̂ ŕêṕôŕt̂ś t̂ó..."
34
- },
35
- "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionSnapshot": {
36
- "message": "Ûśê Śn̂áp̂śĥót̂ ŕêṕôŕt̂ś t̂ó..."
37
- },
38
- "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionTimespan": {
39
- "message": "Ûśê T́îḿêśp̂án̂ ŕêṕôŕt̂ś t̂ó..."
40
- },
41
- "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation1": {
42
- "message": "Ôb́t̂áîń â Ĺîǵĥt́ĥóûśê Ṕêŕf̂ór̂ḿâńĉé ŝćôŕê."
43
- },
44
- "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation2": {
45
- "message": "M̂éâśûŕê ṕâǵê ĺôád̂ Ṕêŕf̂ór̂ḿâńĉé m̂ét̂ŕîćŝ śûćĥ áŝ Ĺâŕĝéŝt́ Ĉón̂t́êńt̂f́ûĺ P̂áîńt̂ án̂d́ Ŝṕêéd̂ Ín̂d́êx́."
46
- },
47
- "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation3": {
48
- "message": "Âśŝéŝś P̂ŕôǵr̂éŝśîv́ê Ẃêb́ Âṕp̂ ćâṕâb́îĺît́îéŝ."
49
- },
50
- "flow-report/src/i18n/ui-strings.js | helpUseCaseSnapshot1": {
51
- "message": "F̂ín̂d́ âćĉéŝśîb́îĺît́ŷ íŝśûéŝ ín̂ śîńĝĺê ṕâǵê áp̂ṕl̂íĉát̂íôńŝ ór̂ ćôḿp̂ĺêx́ f̂ór̂ḿŝ."
52
- },
53
- "flow-report/src/i18n/ui-strings.js | helpUseCaseSnapshot2": {
54
- "message": "Êv́âĺûát̂é b̂éŝt́ p̂ŕâćt̂íĉéŝ óf̂ ḿêńûś âńd̂ ÚÎ él̂ém̂én̂t́ŝ h́îd́d̂én̂ b́êh́îńd̂ ín̂t́êŕâćt̂íôń."
55
- },
56
- "flow-report/src/i18n/ui-strings.js | helpUseCaseTimespan1": {
57
- "message": "M̂éâśûŕê ĺâýôút̂ śĥíf̂t́ŝ án̂d́ Ĵáv̂áŜćr̂íp̂t́ êx́êćût́îón̂ t́îḿê ón̂ á ŝér̂íêś ôf́ îńt̂ér̂áĉt́îón̂ś."
58
- },
59
- "flow-report/src/i18n/ui-strings.js | helpUseCaseTimespan2": {
60
- "message": "D̂íŝćôv́êŕ p̂ér̂f́ôŕm̂án̂ćê óp̂ṕôŕt̂ún̂ít̂íêś t̂ó îḿp̂ŕôv́ê t́ĥé êx́p̂ér̂íêńĉé f̂ór̂ ĺôńĝ-ĺîv́êd́ p̂áĝéŝ án̂d́ ŝín̂ǵl̂é-p̂áĝé âṕp̂ĺîćât́îón̂ś."
61
- },
62
- "flow-report/src/i18n/ui-strings.js | mobile": {
63
- "message": "M̂ób̂íl̂é"
64
- },
65
- "flow-report/src/i18n/ui-strings.js | navigationDescription": {
66
- "message": "P̂áĝé l̂óâd́"
67
- },
68
- "flow-report/src/i18n/ui-strings.js | navigationLongDescription": {
69
- "message": "N̂áv̂íĝát̂íôń r̂ép̂ór̂t́ŝ án̂ál̂ýẑé â śîńĝĺê ṕâǵê ĺôád̂, éx̂áĉt́l̂ý l̂ík̂é t̂h́ê ór̂íĝín̂ál̂ Ĺîǵĥt́ĥóûśê ŕêṕôŕt̂ś."
70
- },
71
- "flow-report/src/i18n/ui-strings.js | navigationReport": {
72
- "message": "N̂áv̂íĝát̂íôń r̂ép̂ór̂t́"
73
- },
74
- "flow-report/src/i18n/ui-strings.js | ratingAverage": {
75
- "message": "Âv́êŕâǵê"
76
- },
77
- "flow-report/src/i18n/ui-strings.js | ratingError": {
78
- "message": "Êŕr̂ór̂"
79
- },
80
- "flow-report/src/i18n/ui-strings.js | ratingFail": {
81
- "message": "P̂óôŕ"
82
- },
83
- "flow-report/src/i18n/ui-strings.js | ratingPass": {
84
- "message": "Ĝóôd́"
85
- },
86
- "flow-report/src/i18n/ui-strings.js | save": {
87
- "message": "Ŝáv̂é"
88
- },
89
- "flow-report/src/i18n/ui-strings.js | snapshotDescription": {
90
- "message": "Ĉáp̂t́ûŕêd́ ŝt́ât́ê óf̂ ṕâǵê"
91
- },
92
- "flow-report/src/i18n/ui-strings.js | snapshotLongDescription": {
93
- "message": "Ŝńâṕŝh́ôt́ r̂ép̂ór̂t́ŝ án̂ál̂ýẑé t̂h́ê ṕâǵê ín̂ á p̂ár̂t́îćûĺâŕ ŝt́ât́ê, t́ŷṕîćâĺl̂ý âf́t̂ér̂ úŝér̂ ín̂t́êŕâćt̂íôńŝ."
94
- },
95
- "flow-report/src/i18n/ui-strings.js | snapshotReport": {
96
- "message": "Ŝńâṕŝh́ôt́ r̂ép̂ór̂t́"
97
- },
98
- "flow-report/src/i18n/ui-strings.js | summary": {
99
- "message": "Ŝúm̂ḿâŕŷ"
100
- },
101
- "flow-report/src/i18n/ui-strings.js | timespanDescription": {
102
- "message": "Ûśêŕ îńt̂ér̂áĉt́îón̂ś"
103
- },
104
- "flow-report/src/i18n/ui-strings.js | timespanLongDescription": {
105
- "message": "T̂ím̂éŝṕâń r̂ép̂ór̂t́ŝ án̂ál̂ýẑé âń âŕb̂ít̂ŕâŕŷ ṕêŕîód̂ óf̂ t́îḿê, t́ŷṕîćâĺl̂ý ĉón̂t́âín̂ín̂ǵ ûśêŕ îńt̂ér̂áĉt́îón̂ś."
106
- },
107
- "flow-report/src/i18n/ui-strings.js | timespanReport": {
108
- "message": "T̂ím̂éŝṕâń r̂ép̂ór̂t́"
109
- },
110
- "flow-report/src/i18n/ui-strings.js | title": {
111
- "message": "L̂íĝh́t̂h́ôúŝé Ûśêŕ F̂ĺôẃ R̂ép̂ór̂t́"
112
- },
113
2
  "lighthouse-core/audits/accessibility/accesskeys.js | description": {
114
3
  "message": "Âćĉéŝś k̂éŷś l̂ét̂ úŝér̂ś q̂úîćk̂ĺŷ f́ôćûś â ṕâŕt̂ óf̂ t́ĥé p̂áĝé. F̂ór̂ ṕr̂óp̂ér̂ ńâv́îǵât́îón̂, éâćĥ áĉćêśŝ ḱêý m̂úŝt́ b̂é ûńîq́ûé. [L̂éâŕn̂ ḿôŕê](https://web.dev/accesskeys/)."
115
4
  },
@@ -16,7 +16,6 @@
16
16
 
17
17
  // TODO(paulirish): Centralize locale inheritance (combining this & i18n.lookupLocale()), adopt cldr parentLocale rules.
18
18
 
19
- /** @typedef {import('../../types/lhr/settings').Locale} Locale */
20
19
  /** @typedef {Record<string, {message: string}>} LhlMessages */
21
20
 
22
21
  const fs = require('fs');
@@ -74,7 +73,7 @@ const files = {
74
73
  };
75
74
 
76
75
  // The keys within this const must exactly match the LH.Locale type in externs.d.ts
77
- /** @type {Record<Locale, LhlMessages>} */
76
+ /** @type {Record<LH.Locale, LhlMessages>} */
78
77
  const locales = {
79
78
  'en-US': files['en-US'], // The 'source' strings, with descriptions
80
79
  'en': files['en-US'], // According to CLDR/ICU, 'en' == 'en-US' dates/numbers (Why?!)
@@ -8,7 +8,7 @@
8
8
  const _set = require('lodash.set');
9
9
  const _get = require('lodash.get');
10
10
 
11
- const format = require('./format.js');
11
+ const i18n = require('./i18n.js');
12
12
 
13
13
  /**
14
14
  * @fileoverview Use the lhr.i18n.icuMessagePaths object to change locales.
@@ -16,7 +16,7 @@ const format = require('./format.js');
16
16
  * `icuMessagePaths` is an object keyed by `LH.IcuMessage['i18nId']`s. Within each is either
17
17
  * 1) an array of strings, which are just object paths to where that message is used in the LHR
18
18
  * 2) an array of `LH.IcuMessagePath`s which include both a `path` and a `values` object
19
- * which will be used in the replacement within `format.getFormatted()`
19
+ * which will be used in the replacement within `i18n.getFormatted()`
20
20
  *
21
21
  * An example:
22
22
  "icuMessagePaths": {
@@ -49,9 +49,7 @@ function swapLocale(lhr, requestedLocale) {
49
49
  // Copy LHR to avoid mutating provided LHR.
50
50
  lhr = JSON.parse(JSON.stringify(lhr));
51
51
 
52
- if (!format.hasLocale(requestedLocale)) {
53
- throw new Error(`Unsupported locale '${requestedLocale}'`);
54
- }
52
+ const locale = i18n.lookupLocale(requestedLocale);
55
53
  const originalLocale = lhr.configSettings.locale;
56
54
  const {icuMessagePaths} = lhr.i18n;
57
55
  const missingIcuMessageIds = [];
@@ -85,11 +83,11 @@ function swapLocale(lhr, requestedLocale) {
85
83
  formattedDefault: originalString,
86
84
  };
87
85
  // Get new formatted strings in revised locale.
88
- const relocalizedString = format.getFormatted(icuMessage, requestedLocale);
86
+ const relocalizedString = i18n.getFormatted(icuMessage, locale);
89
87
 
90
88
  // If we couldn't find a new replacement message, keep things as is.
91
89
  if (relocalizedString === originalString) {
92
- if (requestedLocale !== originalLocale) {
90
+ if (locale !== originalLocale) {
93
91
  // If the string remained the same while the locale changed, there may have been an issue.
94
92
  missingIcuMessageIds.push(i18nId);
95
93
  }
@@ -101,9 +99,9 @@ function swapLocale(lhr, requestedLocale) {
101
99
  }
102
100
  }
103
101
 
104
- lhr.i18n.rendererFormattedStrings = format.getRendererFormattedStrings(requestedLocale);
102
+ lhr.i18n.rendererFormattedStrings = i18n.getRendererFormattedStrings(locale);
105
103
  // Tweak the config locale
106
- lhr.configSettings.locale = requestedLocale;
104
+ lhr.configSettings.locale = locale;
107
105
  return {
108
106
  lhr,
109
107
  missingIcuMessageIds,
@@ -530,8 +530,8 @@ module.exports = {
530
530
  getElementsInDocument,
531
531
  getElementsInDocumentString: getElementsInDocument.toString(),
532
532
  getOuterHTMLSnippetString: getOuterHTMLSnippet.toString(),
533
- getOuterHTMLSnippet,
534
- computeBenchmarkIndex,
533
+ getOuterHTMLSnippet: getOuterHTMLSnippet,
534
+ computeBenchmarkIndex: computeBenchmarkIndex,
535
535
  computeBenchmarkIndexString: computeBenchmarkIndex.toString(),
536
536
  getMaxTextureSize,
537
537
  getNodeDetailsString,
@@ -539,8 +539,8 @@ module.exports = {
539
539
  getNodePathString: getNodePath.toString(),
540
540
  getNodeSelectorString: getNodeSelector.toString(),
541
541
  getNodePath,
542
- getNodeSelector,
543
- getNodeLabel,
542
+ getNodeSelector: getNodeSelector,
543
+ getNodeLabel: getNodeLabel,
544
544
  getNodeLabelString: getNodeLabel.toString(),
545
545
  isPositionFixedString: isPositionFixed.toString(),
546
546
  wrapRequestIdleCallback,
@@ -9,6 +9,18 @@ const log = require('lighthouse-logger');
9
9
  const stackPacks = require('lighthouse-stack-packs');
10
10
  const i18n = require('./i18n/i18n.js');
11
11
 
12
+ /**
13
+ * Resolve a module on web and node
14
+ * @param {string} module
15
+ */
16
+ function resolve(module) {
17
+ if (!require.resolve) {
18
+ return `node_modules/${module}`;
19
+ }
20
+
21
+ return require.resolve(module);
22
+ }
23
+
12
24
  /**
13
25
  * Pairs consisting of a stack pack's ID and the set of stacks needed to be
14
26
  * detected in a page to display that pack's advice.
@@ -75,7 +87,7 @@ function getStackPacks(pageStacks) {
75
87
 
76
88
  // Create i18n handler to get translated strings.
77
89
  const str_ = i18n.createMessageInstanceIdFn(
78
- `node_modules/lighthouse-stack-packs/packs/${matchedPack.id}.js`,
90
+ resolve(`lighthouse-stack-packs/packs/${matchedPack.id}`),
79
91
  matchedPack.UIStrings
80
92
  );
81
93
 
@@ -11,7 +11,7 @@ const GatherRunner = require('./gather/gather-runner.js');
11
11
  const ReportScoring = require('./scoring.js');
12
12
  const Audit = require('./audits/audit.js');
13
13
  const log = require('lighthouse-logger');
14
- const format = require('../shared/localization/format.js');
14
+ const i18n = require('./lib/i18n/i18n.js');
15
15
  const stackPacks = require('./lib/stack-packs.js');
16
16
  const assetSaver = require('./lib/asset-saver.js');
17
17
  const fs = require('fs');
@@ -152,14 +152,14 @@ class Runner {
152
152
  categoryGroups: runOpts.config.groups || undefined,
153
153
  timing: this._getTiming(artifacts),
154
154
  i18n: {
155
- rendererFormattedStrings: format.getRendererFormattedStrings(settings.locale),
155
+ rendererFormattedStrings: i18n.getRendererFormattedStrings(settings.locale),
156
156
  icuMessagePaths: {},
157
157
  },
158
158
  stackPacks: stackPacks.getStackPacks(artifacts.Stacks),
159
159
  };
160
160
 
161
161
  // Replace ICU message references with localized strings; save replaced paths in lhr.
162
- i18nLhr.i18n.icuMessagePaths = format.replaceIcuMessages(i18nLhr, settings.locale);
162
+ i18nLhr.i18n.icuMessagePaths = i18n.replaceIcuMessages(i18nLhr, settings.locale);
163
163
 
164
164
  // LHR has now been localized.
165
165
  const lhr = /** @type {LH.Result} */ (i18nLhr);
@@ -177,7 +177,7 @@ class Runner {
177
177
  } catch (err) {
178
178
  // i18n LighthouseError strings.
179
179
  if (err.friendlyMessage) {
180
- err.friendlyMessage = format.getFormatted(err.friendlyMessage, settings.locale);
180
+ err.friendlyMessage = i18n.getFormatted(err.friendlyMessage, settings.locale);
181
181
  }
182
182
  await Sentry.captureException(err, {level: 'fatal'});
183
183
  throw err;
@@ -211,7 +211,7 @@ class Runner {
211
211
  duration: parseFloat(entry.duration.toFixed(2)),
212
212
  entryType: entry.entryType,
213
213
  };
214
- }).sort((a, b) => a.startTime - b.startTime);
214
+ });
215
215
  const runnerEntry = timingEntries.find(e => e.name === 'lh:runner:run');
216
216
  return {entries: timingEntries, total: runnerEntry && runnerEntry.duration || 0};
217
217
  }
@@ -301,7 +301,7 @@ class Runner {
301
301
  static async _runAudit(auditDefn, artifacts, sharedAuditContext, runWarnings) {
302
302
  const audit = auditDefn.implementation;
303
303
  const status = {
304
- msg: `Auditing: ${format.getFormatted(audit.meta.title, 'en-US')}`,
304
+ msg: `Auditing: ${i18n.getFormatted(audit.meta.title, 'en-US')}`,
305
305
  id: `lh:audit:${audit.meta.id}`,
306
306
  };
307
307
  log.time(status);
@@ -1,12 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  'use strict';
4
-
5
4
  /**
6
5
  * @fileoverview Script to launch a clean Chrome instance on-demand.
7
6
  *
8
- * node lighthouse-core/scripts/manual-chrome-launcher.js
9
- *
10
7
  * Assuming Lighthouse is installed globally or `npm link`ed, use via:
11
8
  * chrome-debug
12
9
  * Optionally enable extensions or pass a port, additional chrome flags, and/or a URL
@@ -16,7 +13,7 @@
16
13
  * chrome-debug --enable-extensions
17
14
  */
18
15
 
19
- import {Launcher, launch} from 'chrome-launcher';
16
+ const {Launcher, launch} = require('chrome-launcher');
20
17
 
21
18
  const args = process.argv.slice(2);
22
19
  const chromeFlags = [];
@@ -521,31 +521,15 @@ class Util {
521
521
  * @param {LH.ReportResult.Category} category
522
522
  */
523
523
  static calculateCategoryFraction(category) {
524
- let numPassableAudits = 0;
524
+ const numAudits = category.auditRefs.length;
525
+
525
526
  let numPassed = 0;
526
- let numInformative = 0;
527
527
  let totalWeight = 0;
528
528
  for (const auditRef of category.auditRefs) {
529
- const auditPassed = Util.showAsPassed(auditRef.result);
530
- const notDisplayed = !auditRef.group && category.id === 'performance';
531
-
532
- // Don't count the audit if it's manual, N/A, or isn't displayed.
533
- if (notDisplayed ||
534
- auditRef.result.scoreDisplayMode === 'manual' ||
535
- auditRef.result.scoreDisplayMode === 'notApplicable') {
536
- continue;
537
- } else if (auditRef.result.scoreDisplayMode === 'informative') {
538
- if (!auditPassed) {
539
- ++numInformative;
540
- }
541
- continue;
542
- }
543
-
544
- ++numPassableAudits;
545
529
  totalWeight += auditRef.weight;
546
- if (auditPassed) numPassed++;
530
+ if (Util.showAsPassed(auditRef.result)) numPassed++;
547
531
  }
548
- return {numPassed, numPassableAudits, numInformative, totalWeight};
532
+ return {numPassed, numAudits, totalWeight};
549
533
  }
550
534
  }
551
535
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "8.5.1-dev.20211012",
3
+ "version": "8.5.1",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  "smokehouse": "./lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js"
10
10
  },
11
11
  "engines": {
12
- "node": ">=12.20.0 12 || >=14.13 14 || >=15"
12
+ "node": ">=12.13.0"
13
13
  },
14
14
  "scripts": {
15
15
  "build-all": "npm-run-posix-or-windows build-all:task",
@@ -21,7 +21,7 @@
21
21
  "build-extension-firefox": "node ./build/build-extension.js firefox",
22
22
  "build-devtools": "yarn reset-link && node ./build/build-bundle.js clients/devtools-entry.js dist/lighthouse-dt-bundle.js && node ./build/build-dt-report-resources.js",
23
23
  "build-smokehouse-bundle": "node ./build/build-smokehouse-bundle.js",
24
- "build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js",
24
+ "build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js && rollup lighthouse-cli/test/fixtures/static-server.js -o dist/lightrider/static-server.js -f commonjs -p commonjs -p node-resolve -e mime-types,glob",
25
25
  "build-pack": "bash build/build-pack.sh",
26
26
  "build-report": "node build/build-report-components.js && yarn eslint --fix report/renderer/components.js && node build/build-report.js",
27
27
  "build-sample-reports": "yarn build-report && node build/build-sample-reports.js",
@@ -29,7 +29,7 @@
29
29
  "build-viewer": "node ./build/build-viewer.js",
30
30
  "reset-link": "(yarn unlink || true) && yarn link && yarn link lighthouse",
31
31
  "c8": "bash lighthouse-core/scripts/c8.sh",
32
- "clean": "rm -r dist proto/scripts/*.json proto/scripts/*_pb2.* proto/scripts/*_pb.* proto/scripts/__pycache__ proto/scripts/*.pyc *.report.html *.report.dom.html *.report.json *.devtoolslog.json *.trace.json shared/localization/locales/*.ctc.json || true",
32
+ "clean": "rm -r dist proto/scripts/*.json proto/scripts/*_pb2.* proto/scripts/*_pb.* proto/scripts/__pycache__ proto/scripts/*.pyc *.report.html *.report.dom.html *.report.json *.devtoolslog.json *.trace.json lighthouse-core/lib/i18n/locales/*.ctc.json || true",
33
33
  "lint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .",
34
34
  "smoke": "node lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js",
35
35
  "debug": "node --inspect-brk ./lighthouse-cli/index.js",
@@ -37,12 +37,12 @@
37
37
  "jest": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
38
38
  "test": "yarn diff:sample-json && yarn lint --quiet && yarn unit && yarn type-check",
39
39
  "test-bundle": "yarn smoke --runner bundle -j=1 --retries=2 --invert-match forms",
40
- "test-clients": "yarn jest \"$PWD/clients/\" && yarn jest --testMatch=\"**/clients/test/**/*-test-pptr.js\"",
41
- "test-viewer": "yarn unit-viewer && yarn jest --testMatch=\"**/lighthouse-viewer/**/*-test-pptr.js\"",
42
- "test-treemap": "yarn unit-treemap && yarn jest --testMatch=\"**/lighthouse-treemap/**/*-test-pptr.js\"",
40
+ "test-clients": "yarn jest \"$PWD/clients/\"",
41
+ "test-viewer": "yarn unit-viewer && yarn jest lighthouse-viewer/test/viewer-test-pptr.js",
42
+ "test-treemap": "yarn unit-treemap && yarn jest lighthouse-treemap/test/treemap-test-pptr.js",
43
43
  "test-lantern": "bash lighthouse-core/scripts/test-lantern.sh",
44
44
  "test-legacy-javascript": "bash lighthouse-core/scripts/test-legacy-javascript.sh",
45
- "test-docs": "yarn --cwd docs/recipes/ test",
45
+ "test-docs": "yarn --cwd docs/recipes/auth && yarn jest docs/recipes/integration-test && yarn --cwd docs/recipes/custom-gatherer-puppeteer test",
46
46
  "test-proto": "yarn compile-proto && yarn build-proto-roundtrip",
47
47
  "unit-core": "yarn jest \"lighthouse-core\"",
48
48
  "unit-cli": "yarn jest \"lighthouse-cli/\"",
@@ -50,8 +50,8 @@
50
50
  "unit-treemap": "yarn jest \"lighthouse-treemap/.*-test.js\"",
51
51
  "unit-viewer": "yarn jest \"lighthouse-viewer/.*-test.js\"",
52
52
  "unit-flow": "yarn jest \"flow-report/.*-test.[tj]s[x]?\"",
53
- "unit": "yarn jest",
54
- "unit:ci": "NODE_OPTIONS=--max-old-space-size=8192 npm run jest -- --ci",
53
+ "unit": "yarn unit-core && yarn unit-cli && yarn unit-report && yarn unit-viewer && yarn unit-treemap && yarn unit-flow",
54
+ "unit:ci": "NODE_OPTIONS=--max-old-space-size=8192 npm run unit-core -- --ci && npm run unit-cli -- --ci && npm run unit-report -- --ci && npm run unit-viewer -- --ci && npm run unit-treemap -- --ci && npm run unit-flow -- --ci",
55
55
  "core-unit": "yarn unit-core",
56
56
  "cli-unit": "yarn unit-cli",
57
57
  "viewer-unit": "yarn unit-viewer",
@@ -74,7 +74,6 @@
74
74
  "update:lantern-baseline": "node lighthouse-core/scripts/lantern/update-baseline-lantern-values.js",
75
75
  "update:sample-artifacts": "node lighthouse-core/scripts/update-report-fixtures.js",
76
76
  "update:sample-json": "yarn i18n:collect-strings && node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --config-path=./lighthouse-core/test/results/sample-config.js --output=json --output-path=./lighthouse-core/test/results/sample_v2.json && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing",
77
- "update:flow-sample-json": "node ./lighthouse-core/scripts/update-flow-fixtures.js",
78
77
  "update:test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh --reset-results",
79
78
  "test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh",
80
79
  "open-devtools": "bash lighthouse-core/scripts/open-devtools.sh",
@@ -89,12 +88,13 @@
89
88
  "serve-dist": "cd dist && python -m SimpleHTTPServer",
90
89
  "serve-gh-pages": "cd dist/gh-pages && python -m SimpleHTTPServer",
91
90
  "serve-treemap": "yarn serve-gh-pages",
92
- "serve-viewer": "yarn serve-gh-pages",
93
- "flow-report": "yarn build-report --flow && node ./lighthouse-core/scripts/build-test-flow-report.js"
91
+ "serve-viewer": "yarn serve-gh-pages"
94
92
  },
95
93
  "devDependencies": {
96
94
  "@build-tracker/cli": "^1.0.0-beta.15",
97
- "@rollup/plugin-commonjs": "^20.0.0",
95
+ "@firebase/app-types": "0.3.1",
96
+ "@firebase/auth-types": "0.3.2",
97
+ "@firebase/util": "0.2.1",
98
98
  "@rollup/plugin-node-resolve": "^13.0.4",
99
99
  "@rollup/plugin-typescript": "^8.2.5",
100
100
  "@testing-library/preact": "^2.0.1",
@@ -134,7 +134,7 @@
134
134
  "browserify-banner": "^1.0.15",
135
135
  "c8": "^7.4.0",
136
136
  "chalk": "^2.4.1",
137
- "chrome-devtools-frontend": "1.0.922924",
137
+ "chrome-devtools-frontend": "1.0.727089",
138
138
  "conventional-changelog-cli": "^1.3.4",
139
139
  "cpy": "^7.0.1",
140
140
  "cross-env": "^7.0.2",
@@ -147,7 +147,6 @@
147
147
  "eslint-plugin-local-rules": "0.1.0",
148
148
  "event-target-shim": "^6.0.2",
149
149
  "exorcist": "^1.0.1",
150
- "firebase": "^9.0.2",
151
150
  "gh-pages": "^2.0.1",
152
151
  "glob": "^7.1.3",
153
152
  "idb-keyval": "2.2.0",
@@ -166,9 +165,8 @@
166
165
  "pretty-json-stringify": "^0.0.2",
167
166
  "puppeteer": "^10.2.0",
168
167
  "rollup": "^2.50.6",
168
+ "rollup-plugin-commonjs": "^10.1.0",
169
169
  "rollup-plugin-node-resolve": "^5.2.0",
170
- "rollup-plugin-polyfill-node": "^0.7.0",
171
- "rollup-plugin-replace": "^2.2.0",
172
170
  "rollup-plugin-shim": "^1.0.0",
173
171
  "rollup-plugin-terser": "^7.0.2",
174
172
  "tabulator-tables": "^4.9.3",
@@ -176,7 +174,6 @@
176
174
  "ts-jest": "^27.0.4",
177
175
  "typed-query-selector": "^2.4.0",
178
176
  "typescript": "4.4.3",
179
- "wait-for-expect": "^3.0.2",
180
177
  "webtreemap-cdt": "^3.2.1"
181
178
  },
182
179
  "dependencies": {
package/readme.md CHANGED
@@ -52,7 +52,7 @@ The Chrome extension was available prior to Lighthouse being available in Chrome
52
52
 
53
53
  The Node CLI provides the most flexibility in how Lighthouse runs can be configured and reported. Users who want more advanced usage, or want to run Lighthouse in an automated fashion should use the Node CLI.
54
54
 
55
- _Lighthouse requires Node 12 LTS (12.20) or later._
55
+ _Lighthouse requires Node 12 LTS (12.x) or later._
56
56
 
57
57
  **Installation**:
58
58
 
@@ -21,6 +21,7 @@ limitations under the License.
21
21
  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
22
22
  <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEhklEQVR4AWJxL/BhIAesev1U5tcflpncgNrKIsqNIwzC9feMpDUzs70kOczMzMzJJcxwCTMzncPMnOwtzBwzMzPb0vRfeZPp0VhPS5I39V5fdiXV1/VD+9QC7OVn9BsyH1XIoEI1PfmJvLFowVV564+34DFUHudbmfDh4kVXh//7XwE+WjS/YfXZe3yr4j2rqj1AIhSB7hZ8ZtPZu/zw8cK523U4wE1/rvPfWrz4zs0m9ZdC9yUJAlASdBAgocRegfF/f3/h/PuaFsxMdwjAR0vm1+06eMMfIrhLqTWqdH4EumU2SPfMhigJAlRQbZrgrRsl9U+Y2DYDFCz3ILC9kiAiqSrMwbWT0nceEnR+9Kggc2zjOJCASDENkg0a5HfZZgDP81CM3CrQs2Z1+o7DJ6ePr8sK0AOCHv5Jjdt3evyYSaZ351VIStIxPRAUtrBYbxC6w+BZ0ivVSBKkIhJhemSyZpfB00EiPO2VjzYkxhcqXQqCWCShGplvi3y0QxqbuBurMjyJeWnkHZuAEgIQGsUBqwrfjZ+IlBgKyRJzVVYF8O6qFWdh86YzQzMrZigYmxAyfvHgLZQ/LC1CbeniW2Hkqr/PH16SgvGuf2/uzNMBwJA/njxizGPtSyAf7EziJCMGRDRdhoAC4PL1A/SrKQMAAQkEfpJAcRQdrBJ7gNwjSpJsdwK+CANBkqa1LgQB4IicV9nYUct7gaxuDJUErQIiEAiMxLVOFlKzIktPpT0ggpdpC/8YAHnxbgkUY4tAAFSR7AAXNyAAWHJrA/kHGjzg5nleuwFO7Nd/IoDw4Pm58+4jNLmYG0wRA5bErc2Mr3Y+dXTDW1VvwqbJkzMCHQ4S1GTCBOIgUHJrGdEwqzR+jAp/o2qAZelUDoQnruEEdDclJI6576AlNVfc+22XN/+Y1vnJD0Yind6UpEEvn/Hqq15EYjCW7jZCJEpnNvDgkyelDjs106kuux2AAXCSobULOWP8mLhYlpoDMK4qAFXJGk+grtH8YXVz5KJblqaG1+VUdTc0I290bmUQAriGITRbdQnom0aoFj8kx1+wMD2ifncAXUQE4SkDqN1hE0jEophs1SUwZAOhUAiMCLwRtamtTZtbbmZErSAUHbSysaoEmnrsakiMiUAURi283gN6wans9oX8rOCrj7/JP35DFD+iQ7Au/K2KE1jzx6ujjUnXFH9KjEq6ZlhsTBICrNLJf47Pv/pkHzvup1w4dmUbEei0+bcXRqJuh5kVARQ8byyYxOwNGr7A87xh1tp8sGT+uMInrwi++Xj7TQz2d27NvwEkrOflAFQGIDA5khASBCGdO2/Z/MnLPwYfv5TFhjW7QhVKAB6afwe2LpFlFsCnlQEosgQgDsdOG1/LKeNqJS4JCSPJ/i+TakwEARor7gER1Iva5JmPOJK0RUqmoPnnlzFCtmIAhAAQEIQRgDaiYPIauNXcnDlRIrWNFY3hm7PG9YRqr7IV7HrCgAC17befjEvRq2nGhAHtBqDpOuI/I1diUUAMYIxEdyejBJqLnNoszGZtfiX/CztGv2mq+sdaAAAAAElFTkSuQmCC">
23
23
  <title>Lighthouse Report</title>
24
+ <style>/*%%LIGHTHOUSE_CSS%%*/</style>
24
25
  </head>
25
26
  <body class="lh-root lh-vars">
26
27
  <noscript>Lighthouse report requires JavaScript. Please enable.</noscript>