lighthouse 8.5.1 → 8.6.0-dev.20211013

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/changelog.md +5490 -0
  2. package/flow-report/.eslintrc.cjs +49 -0
  3. package/flow-report/assets/styles.css +272 -9
  4. package/flow-report/jest.config.js +1 -1
  5. package/flow-report/package.json +4 -0
  6. package/flow-report/src/app.tsx +31 -9
  7. package/flow-report/src/common.tsx +86 -7
  8. package/flow-report/src/header.tsx +88 -0
  9. package/flow-report/src/help-dialog.tsx +120 -0
  10. package/flow-report/src/i18n/i18n.tsx +44 -0
  11. package/flow-report/src/i18n/localized-strings.js +11 -0
  12. package/flow-report/src/i18n/ui-strings.js +86 -0
  13. package/flow-report/src/icons.tsx +20 -3
  14. package/flow-report/src/sidebar/sidebar.tsx +11 -16
  15. package/flow-report/src/summary/category.tsx +42 -24
  16. package/flow-report/src/summary/summary.tsx +32 -29
  17. package/flow-report/src/topbar.tsx +54 -4
  18. package/flow-report/src/util.ts +26 -1
  19. package/flow-report/src/wrappers/report-renderer.tsx +1 -1
  20. package/flow-report/src/wrappers/report.tsx +6 -21
  21. package/flow-report/test/app-test.tsx +17 -13
  22. package/flow-report/test/common-test.tsx +89 -0
  23. package/flow-report/test/header-test.tsx +55 -0
  24. package/flow-report/test/sample-flow.ts +17 -0
  25. package/flow-report/test/setup/env-setup.ts +1 -0
  26. package/flow-report/test/sidebar/flow-test.tsx +6 -12
  27. package/flow-report/test/sidebar/sidebar-test.tsx +7 -13
  28. package/flow-report/test/summary/category-test.tsx +79 -34
  29. package/flow-report/test/summary/summary-test.tsx +11 -17
  30. package/flow-report/test/topbar-test.tsx +68 -0
  31. package/flow-report/test/util-test.tsx +1 -12
  32. package/flow-report/tsconfig.json +1 -0
  33. package/flow-report/types/flow-report.d.ts +2 -1
  34. package/jest.config.js +1 -15
  35. package/lighthouse-cli/bin.js +5 -0
  36. package/lighthouse-cli/cli-flags.js +10 -3
  37. package/lighthouse-cli/commands/commands.js +1 -0
  38. package/lighthouse-cli/commands/list-locales.js +16 -0
  39. package/lighthouse-cli/run.js +2 -2
  40. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
  41. package/lighthouse-cli/test/smokehouse/report-assert.js +20 -4
  42. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +2 -1
  43. package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
  44. package/lighthouse-core/audits/seo/crawlable-anchors.js +10 -12
  45. package/lighthouse-core/computed/js-bundles.js +1 -2
  46. package/lighthouse-core/computed/unused-javascript-summary.js +3 -3
  47. package/lighthouse-core/config/config.js +2 -2
  48. package/lighthouse-core/config/default-config.js +5 -0
  49. package/lighthouse-core/fraggle-rock/api.js +10 -0
  50. package/lighthouse-core/fraggle-rock/config/filters.js +22 -3
  51. package/lighthouse-core/fraggle-rock/gather/driver.js +4 -0
  52. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -2
  53. package/lighthouse-core/fraggle-rock/user-flow.js +35 -6
  54. package/lighthouse-core/gather/driver/navigation.js +5 -0
  55. package/lighthouse-core/gather/driver/prepare.js +14 -0
  56. package/lighthouse-core/gather/driver/storage.js +5 -0
  57. package/lighthouse-core/gather/gather-runner.js +2 -2
  58. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +5 -1
  59. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +30 -24
  60. package/lighthouse-core/lib/cdt/Platform.js +55 -0
  61. package/lighthouse-core/lib/cdt/SDK.js +3 -123
  62. package/lighthouse-core/lib/cdt/generated/SourceMap.js +148 -312
  63. package/lighthouse-core/lib/csp-evaluator.js +2 -1
  64. package/lighthouse-core/lib/i18n/README.md +6 -6
  65. package/lighthouse-core/lib/i18n/i18n.js +9 -342
  66. package/lighthouse-core/lib/page-functions.js +4 -4
  67. package/lighthouse-core/lib/stack-packs.js +1 -13
  68. package/lighthouse-core/runner.js +6 -6
  69. package/lighthouse-core/scripts/manual-chrome-launcher.js +4 -1
  70. package/lighthouse-core/scripts/package.json +4 -0
  71. package/lighthouse-core/util-commonjs.js +20 -4
  72. package/package.json +19 -16
  73. package/readme.md +1 -1
  74. package/report/assets/standalone-template.html +0 -1
  75. package/report/assets/styles.css +16 -41
  76. package/report/assets/templates.html +42 -4
  77. package/report/clients/psi.js +1 -0
  78. package/report/clients/standalone.js +1 -2
  79. package/report/generator/file-namer.js +17 -8
  80. package/report/generator/report-generator.js +0 -1
  81. package/report/renderer/category-renderer.js +4 -16
  82. package/report/renderer/components.js +107 -71
  83. package/report/renderer/dom.js +19 -0
  84. package/report/renderer/logger.js +35 -2
  85. package/report/renderer/performance-category-renderer.js +23 -21
  86. package/report/renderer/pwa-category-renderer.js +1 -2
  87. package/report/renderer/report-renderer.js +21 -0
  88. package/report/renderer/report-ui-features.js +7 -19
  89. package/report/renderer/swap-locale-feature.js +82 -0
  90. package/report/renderer/util.js +20 -4
  91. package/report/test/clients/psi-test.js +0 -4
  92. package/report/test/generator/file-namer-test.js +2 -2
  93. package/report/test/renderer/category-renderer-test.js +1 -1
  94. package/report/test/renderer/performance-category-renderer-test.js +12 -0
  95. package/report/test/renderer/report-renderer-axe-test.js +86 -0
  96. package/report/test/renderer/report-renderer-test.js +0 -55
  97. package/report/test/renderer/util-test.js +68 -8
  98. package/report/test-assets/faux-psi-template.html +0 -1
  99. package/report/tsconfig.json +2 -1
  100. package/report/types/html-renderer.d.ts +2 -1
  101. package/root.js +18 -0
  102. package/shared/localization/format.js +422 -0
  103. package/{lighthouse-core/lib/cdt/Common.js → shared/localization/i18n-module.js} +3 -8
  104. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar-XB.json +139 -4
  105. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar.json +141 -6
  106. package/{lighthouse-core/lib/i18n → shared/localization}/locales/bg.json +139 -4
  107. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ca.json +140 -5
  108. package/{lighthouse-core/lib/i18n → shared/localization}/locales/cs.json +139 -4
  109. package/{lighthouse-core/lib/i18n → shared/localization}/locales/da.json +139 -4
  110. package/{lighthouse-core/lib/i18n → shared/localization}/locales/de.json +139 -4
  111. package/{lighthouse-core/lib/i18n → shared/localization}/locales/el.json +141 -6
  112. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-GB.json +139 -4
  113. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-US.json +111 -0
  114. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XA.json +139 -4
  115. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XL.json +111 -0
  116. package/{lighthouse-core/lib/i18n → shared/localization}/locales/es-419.json +139 -4
  117. package/{lighthouse-core/lib/i18n → shared/localization}/locales/es.json +139 -4
  118. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fi.json +139 -4
  119. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fil.json +139 -4
  120. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fr.json +139 -4
  121. package/{lighthouse-core/lib/i18n → shared/localization}/locales/he.json +139 -4
  122. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hi.json +142 -7
  123. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hr.json +139 -4
  124. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hu.json +139 -4
  125. package/{lighthouse-core/lib/i18n → shared/localization}/locales/id.json +139 -4
  126. package/{lighthouse-core/lib/i18n → shared/localization}/locales/it.json +139 -4
  127. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ja.json +139 -4
  128. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ko.json +139 -4
  129. package/{lighthouse-core/lib/i18n → shared/localization}/locales/lt.json +139 -4
  130. package/{lighthouse-core/lib/i18n → shared/localization}/locales/lv.json +139 -4
  131. package/{lighthouse-core/lib/i18n → shared/localization}/locales/nl.json +139 -4
  132. package/{lighthouse-core/lib/i18n → shared/localization}/locales/no.json +139 -4
  133. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pl.json +139 -4
  134. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt-PT.json +139 -4
  135. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt.json +139 -4
  136. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ro.json +139 -4
  137. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ru.json +139 -4
  138. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sk.json +139 -4
  139. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sl.json +139 -4
  140. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr-Latn.json +139 -4
  141. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr.json +139 -4
  142. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sv.json +139 -4
  143. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ta.json +146 -11
  144. package/{lighthouse-core/lib/i18n → shared/localization}/locales/te.json +179 -44
  145. package/{lighthouse-core/lib/i18n → shared/localization}/locales/th.json +139 -4
  146. package/{lighthouse-core/lib/i18n → shared/localization}/locales/tr.json +139 -4
  147. package/{lighthouse-core/lib/i18n → shared/localization}/locales/uk.json +139 -4
  148. package/{lighthouse-core/lib/i18n → shared/localization}/locales/vi.json +139 -4
  149. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-HK.json +139 -4
  150. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-TW.json +139 -4
  151. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh.json +139 -4
  152. package/{lighthouse-core/lib/i18n → shared/localization}/locales.js +2 -1
  153. package/shared/localization/swap-flow-locale.js +20 -0
  154. package/{lighthouse-core/lib/i18n → shared/localization}/swap-locale.js +9 -7
  155. package/shared/test/localization/format-test.js +377 -0
  156. package/shared/test/localization/locales-test.js +47 -0
  157. package/shared/test/localization/swap-locale-test.js +140 -0
  158. package/shared/tsconfig.json +22 -0
  159. package/{lighthouse-core/lib → shared}/type-verifiers.js +0 -0
  160. package/shared/types/shared.d.ts +24 -0
  161. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +5 -3
  162. package/third-party/chromium-synchronization/installability-errors-test.js +2 -1
  163. package/tsconfig-all.json +1 -0
  164. package/tsconfig-base.json +1 -1
  165. package/tsconfig.json +2 -3
  166. package/types/config.d.ts +1 -0
  167. package/types/es-main.d.ts +18 -0
  168. package/types/externs.d.ts +2 -0
  169. package/types/lhr/flow.d.ts +7 -0
  170. package/types/lhr/i18n.d.ts +0 -3
  171. package/dist/report/flow.js +0 -149
  172. package/dist/report/standalone.js +0 -228
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "8.5.1",
3
+ "version": "8.6.0-dev.20211013",
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.13.0"
12
+ "node": ">=12.20.0 12 || >=14.13 14 || >=15"
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 && 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",
24
+ "build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js",
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 lighthouse-core/lib/i18n/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 shared/localization/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/\"",
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",
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\"",
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/auth && yarn jest docs/recipes/integration-test && yarn --cwd docs/recipes/custom-gatherer-puppeteer test",
45
+ "test-docs": "yarn --cwd docs/recipes/ 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 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",
53
+ "unit": "yarn jest",
54
+ "unit:ci": "NODE_OPTIONS=--max-old-space-size=8192 npm run jest -- --ci",
55
55
  "core-unit": "yarn unit-core",
56
56
  "cli-unit": "yarn unit-cli",
57
57
  "viewer-unit": "yarn unit-viewer",
@@ -74,6 +74,7 @@
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",
77
78
  "update:test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh --reset-results",
78
79
  "test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh",
79
80
  "open-devtools": "bash lighthouse-core/scripts/open-devtools.sh",
@@ -88,13 +89,12 @@
88
89
  "serve-dist": "cd dist && python -m SimpleHTTPServer",
89
90
  "serve-gh-pages": "cd dist/gh-pages && python -m SimpleHTTPServer",
90
91
  "serve-treemap": "yarn serve-gh-pages",
91
- "serve-viewer": "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"
92
94
  },
93
95
  "devDependencies": {
94
96
  "@build-tracker/cli": "^1.0.0-beta.15",
95
- "@firebase/app-types": "0.3.1",
96
- "@firebase/auth-types": "0.3.2",
97
- "@firebase/util": "0.2.1",
97
+ "@rollup/plugin-commonjs": "^20.0.0",
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.727089",
137
+ "chrome-devtools-frontend": "1.0.922924",
138
138
  "conventional-changelog-cli": "^1.3.4",
139
139
  "cpy": "^7.0.1",
140
140
  "cross-env": "^7.0.2",
@@ -147,6 +147,7 @@
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",
150
151
  "gh-pages": "^2.0.1",
151
152
  "glob": "^7.1.3",
152
153
  "idb-keyval": "2.2.0",
@@ -165,8 +166,9 @@
165
166
  "pretty-json-stringify": "^0.0.2",
166
167
  "puppeteer": "^10.2.0",
167
168
  "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",
170
172
  "rollup-plugin-shim": "^1.0.0",
171
173
  "rollup-plugin-terser": "^7.0.2",
172
174
  "tabulator-tables": "^4.9.3",
@@ -174,6 +176,7 @@
174
176
  "ts-jest": "^27.0.4",
175
177
  "typed-query-selector": "^2.4.0",
176
178
  "typescript": "4.4.3",
179
+ "wait-for-expect": "^3.0.2",
177
180
  "webtreemap-cdt": "^3.2.1"
178
181
  },
179
182
  "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.x) or later._
55
+ _Lighthouse requires Node 12 LTS (12.20) or later._
56
56
 
57
57
  **Installation**:
58
58
 
@@ -21,7 +21,6 @@ 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>
25
24
  </head>
26
25
  <body class="lh-root lh-vars">
27
26
  <noscript>Lighthouse report requires JavaScript. Please enable.</noscript>
@@ -92,6 +92,7 @@
92
92
  --footer-padding-vertical: 16px;
93
93
  --gauge-circle-size-big: 112px;
94
94
  --gauge-circle-size: 80px;
95
+ --gauge-circle-size-sm: 36px;
95
96
  --gauge-label-font-size-big: 28px;
96
97
  --gauge-label-font-size: 20px;
97
98
  --gauge-label-line-height-big: 36px;
@@ -103,6 +104,7 @@
103
104
  --highlighter-background-color: var(--report-text-color);
104
105
  --icon-square-size: calc(var(--score-icon-size) * 0.88);
105
106
  --image-preview-size: 48px;
107
+ --locale-selector-background-color: var(--color-white);
106
108
  --metric-toggle-lines-fill: #7F7F7F;
107
109
  --metric-value-font-size: 28px;
108
110
  --metrics-toggle-background-color: var(--color-gray-200);
@@ -168,6 +170,8 @@
168
170
 
169
171
  --pwa-installable-color-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill-rule="nonzero" fill="none"><circle fill="%230CCE6B" cx="12" cy="12" r="12"/><path d="M12 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14zm3.5 7.7h-2.8v2.8h-1.4v-2.8H8.5v-1.4h2.8V8.5h1.4v2.8h2.8v1.4z" fill="%23FFF"/></g></svg>');
170
172
  --pwa-optimized-color-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><rect fill="%230CCE6B" width="24" height="24" rx="12"/><path d="M5 5h14v14H5z"/><path fill="%23FFF" d="M12 15.07l3.6 2.18-.95-4.1 3.18-2.76-4.2-.36L12 6.17l-1.64 3.86-4.2.36 3.2 2.76-.96 4.1z"/></g></svg>');
173
+
174
+ --swap-locale-icon-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"/></svg>');
171
175
  }
172
176
 
173
177
  @media not print {
@@ -190,6 +194,7 @@
190
194
 
191
195
  /* Component variables */
192
196
  --env-item-background-color: var(--color-gray);
197
+ --locale-selector-background-color: var(--color-gray-200);
193
198
  --plugin-badge-background-color: var(--color-gray-800);
194
199
  --report-background-color: var(--color-gray-900);
195
200
  --report-border-color-secondary: var(--color-gray-200);
@@ -310,7 +315,6 @@
310
315
  margin: 0;
311
316
  line-height: var(--report-line-height);
312
317
  background: var(--report-background-color);
313
- scroll-behavior: smooth;
314
318
  color: var(--report-text-color);
315
319
  }
316
320
 
@@ -334,6 +338,10 @@
334
338
  cursor: pointer;
335
339
  }
336
340
 
341
+ .lh-hidden {
342
+ display: none !important;
343
+ }
344
+
337
345
  .lh-container {
338
346
  /*
339
347
  Text wrapping in the report is so much FUN!
@@ -679,8 +687,8 @@
679
687
 
680
688
  .lh-metric__innerwrap {
681
689
  display: grid;
682
- /**
683
- * Icon -- Metric Name
690
+ /**
691
+ * Icon -- Metric Name
684
692
  * -- Metric Value
685
693
  */
686
694
  grid-template-columns: calc(var(--score-icon-size) + var(--score-icon-margin-left) + var(--score-icon-margin-right)) 1fr;
@@ -724,7 +732,7 @@
724
732
  /* Change the grid to 3 columns for narrow viewport. */
725
733
  @media screen and (max-width: 535px) {
726
734
  .lh-metric__innerwrap {
727
- /**
735
+ /**
728
736
  * Icon -- Metric Name -- Metric Value
729
737
  */
730
738
  grid-template-columns: calc(var(--score-icon-size) + var(--score-icon-margin-left) + var(--score-icon-margin-right)) 2fr 1fr;
@@ -1402,6 +1410,10 @@
1402
1410
  padding: var(--category-padding);
1403
1411
  max-width: var(--report-width);
1404
1412
  margin: 0 auto;
1413
+
1414
+ --sticky-header-height: calc(var(--gauge-circle-size-sm) + var(--score-container-padding) * 2);
1415
+ --topbar-plus-sticky-header: calc(var(--topbar-height) + var(--sticky-header-height));
1416
+ scroll-margin-top: var(--topbar-plus-sticky-header);
1405
1417
  }
1406
1418
 
1407
1419
  .lh-category-wrapper {
@@ -1412,18 +1424,6 @@
1412
1424
  border-top: 1px solid var(--color-gray-200);
1413
1425
  }
1414
1426
 
1415
- /* section hash link jump should preserve fixed header
1416
- https://css-tricks.com/hash-tag-links-padding/
1417
- */
1418
- .lh-category > .lh-permalink {
1419
- --sticky-header-height: calc(var(--gauge-circle-size) + var(--score-container-padding) * 2);
1420
- --topbar-plus-header: calc(var(--topbar-height) + var(--sticky-header-height));
1421
- margin-top: calc(var(--topbar-plus-header) * -1);
1422
- padding-bottom: var(--topbar-plus-header);
1423
- display: block;
1424
- visibility: hidden;
1425
- }
1426
-
1427
1427
  .lh-category-header {
1428
1428
  font-size: var(--category-header-font-size);
1429
1429
  min-height: var(--gauge-circle-size);
@@ -1441,31 +1441,6 @@
1441
1441
  line-height: var(--header-line-height);
1442
1442
  }
1443
1443
 
1444
- #lh-log {
1445
- position: fixed;
1446
- background-color: #323232;
1447
- color: #fff;
1448
- min-height: 48px;
1449
- min-width: 288px;
1450
- padding: 16px 24px;
1451
- box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
1452
- border-radius: 2px;
1453
- margin: 12px;
1454
- font-size: 14px;
1455
- cursor: default;
1456
- transition: transform 0.3s, opacity 0.3s;
1457
- transform: translateY(100px);
1458
- opacity: 0;
1459
- bottom: 0;
1460
- left: 0;
1461
- z-index: 3;
1462
- }
1463
-
1464
- #lh-log.lh-show {
1465
- opacity: 1;
1466
- transform: translateY(0);
1467
- }
1468
-
1469
1444
  /* 964 fits the min-width of the filmstrip */
1470
1445
  @media screen and (max-width: 964px) {
1471
1446
  .lh-report {
@@ -165,7 +165,7 @@ limitations under the License.
165
165
  }
166
166
 
167
167
  .lh-sticky-header {
168
- --gauge-circle-size: 36px;
168
+ --gauge-circle-size: var(--gauge-circle-size-sm);
169
169
  --plugin-badge-size: 18px;
170
170
  --plugin-icon-size: 75%;
171
171
  --gauge-wrapper-width: 60px;
@@ -263,12 +263,15 @@ limitations under the License.
263
263
  }
264
264
 
265
265
  .lh-tools {
266
+ display: flex;
267
+ align-items: center;
266
268
  margin-left: auto;
267
269
  will-change: transform;
268
270
  min-width: var(--report-icon-size);
269
271
  }
270
272
  .lh-tools__button {
271
273
  width: var(--report-icon-size);
274
+ min-width: 24px;
272
275
  height: var(--report-icon-size);
273
276
  cursor: pointer;
274
277
  margin-right: 5px;
@@ -325,6 +328,32 @@ limitations under the License.
325
328
  display: none;
326
329
  }
327
330
 
331
+ .lh-locale-selector {
332
+ width: 100%;
333
+ color: var(--report-text-color);
334
+ background-color: var(--locale-selector-background-color);
335
+ padding: 2px;
336
+ }
337
+ .lh-tools-locale {
338
+ display: flex;
339
+ align-items: center;
340
+ flex-direction: row-reverse;
341
+ }
342
+ .lh-tools-locale__selector-wrapper {
343
+ transition: opacity 0.15s;
344
+ opacity: 0;
345
+ max-width: 200px;
346
+ }
347
+ .lh-button.lh-tool-locale__button {
348
+ height: unset;
349
+ color: var(--tools-icon-color);
350
+ }
351
+ .lh-tool-locale__button.lh-active + .lh-tools-locale__selector-wrapper {
352
+ opacity: 1;
353
+ clip: rect(-1px, 194px, 242px, -3px);
354
+ visibility: visible;
355
+ }
356
+
328
357
  @media screen and (max-width: 964px) {
329
358
  .lh-tools__dropdown {
330
359
  right: 0;
@@ -378,6 +407,15 @@ limitations under the License.
378
407
  <a href="" class="lh-topbar__url" target="_blank" rel="noopener"></a>
379
408
 
380
409
  <div class="lh-tools">
410
+ <div class="lh-tools-locale lh-hidden">
411
+ <button id="lh-button__swap-locales" class="lh-button lh-tool-locale__button" title="Show Language Picker" aria-label="Toggle language picker" aria-haspopup="menu" aria-expanded="false" aria-controls="lh-tools-locale__selector-wrapper">
412
+ <svg width="20px" height="20px" viewBox="0 0 24 24" fill="currentColor"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"/></svg>
413
+ </button>
414
+ <div id="lh-tools-locale__selector-wrapper" class="lh-tools-locale__selector-wrapper" role="menu" aria-labelledby="lh-button__swap-locales" aria-hidden="true">
415
+ <!-- Select element created by ReportUIFeatures._enableSwapLocale: .lh-locale-selector -->
416
+ </div>
417
+ </div>
418
+
381
419
  <button id="lh-tools-button" class="lh-tools__button" title="Tools menu" aria-label="Toggle report tools menu" aria-haspopup="menu" aria-expanded="false" aria-controls="lh-tools-dropdown">
382
420
  <svg width="100%" height="100%" viewBox="0 0 24 24">
383
421
  <path d="M0 0h24v24H0z" fill="none"/>
@@ -549,7 +587,7 @@ limitations under the License.
549
587
 
550
588
  <!-- Lighthouse score gauge -->
551
589
  <template id="gauge">
552
- <a href="#" class="lh-gauge__wrapper">
590
+ <a class="lh-gauge__wrapper">
553
591
  <!-- Wrapper exists for the ::before plugin icon. Cannot create pseudo-elements on svgs. -->
554
592
  <div class="lh-gauge__svg-wrapper">
555
593
  <svg viewBox="0 0 120 120" class="lh-gauge">
@@ -565,7 +603,7 @@ limitations under the License.
565
603
 
566
604
  <!-- Lighthouse category fraction -->
567
605
  <template id="fraction">
568
- <a href="#" class="lh-fraction__wrapper">
606
+ <a class="lh-fraction__wrapper">
569
607
  <div class="lh-fraction__content-wrapper">
570
608
  <div class="lh-fraction__content">
571
609
  <div class="lh-fraction__background"></div>
@@ -622,7 +660,7 @@ limitations under the License.
622
660
  }
623
661
  </style>
624
662
 
625
- <a href="#" class="lh-gauge__wrapper lh-gauge--pwa__wrapper">
663
+ <a class="lh-gauge__wrapper lh-gauge--pwa__wrapper">
626
664
  <svg viewBox="0 0 60 60" class="lh-gauge lh-gauge--pwa">
627
665
  <defs>
628
666
  <linearGradient id="lh-gauge--pwa__check-circle__gradient" x1="50%" y1="0%" x2="50%" y2="100%">
@@ -77,6 +77,7 @@ export function prepareLabData(LHResult, document) {
77
77
  reportLHR.categoryGroups,
78
78
  {environment: 'PSI', gatherMode: lhResult.gatherMode}
79
79
  );
80
+ perfCategoryEl.append(dom.createComponent('styles'));
80
81
 
81
82
  const scoreGaugeEl = dom.find('.lh-score__gauge', perfCategoryEl);
82
83
  scoreGaugeEl.remove();
@@ -40,8 +40,7 @@ function __initLighthouseReport__() {
40
40
  });
41
41
 
42
42
  document.addEventListener('lh-log', /** @param {Event} e */ e => {
43
- const el = document.querySelector('#lh-log');
44
- if (!el) return;
43
+ const el = dom.find('div#lh-log', document);
45
44
 
46
45
  const logger = new Logger(el);
47
46
  // @ts-expect-error
@@ -11,15 +11,14 @@
11
11
  */
12
12
 
13
13
  /**
14
- * Generate a filenamePrefix of hostname_YYYY-MM-DD_HH-MM-SS
14
+ * Generate a filenamePrefix of name_YYYY-MM-DD_HH-MM-SS
15
15
  * Date/time uses the local timezone, however Node has unreliable ICU
16
16
  * support, so we must construct a YYYY-MM-DD date format manually. :/
17
- * @param {{finalUrl: string, fetchTime: string}} lhr
18
- * @return {string}
17
+ * @param {string} name
18
+ * @param {string|undefined} fetchTime
19
19
  */
20
- function getFilenamePrefix(lhr) {
21
- const hostname = new URL(lhr.finalUrl).hostname;
22
- const date = (lhr.fetchTime && new Date(lhr.fetchTime)) || new Date();
20
+ function getFilenamePrefix(name, fetchTime) {
21
+ const date = fetchTime ? new Date(fetchTime) : new Date();
23
22
 
24
23
  const timeStr = date.toLocaleTimeString('en-US', {hour12: false});
25
24
  const dateParts = date.toLocaleDateString('en-US', {
@@ -29,9 +28,19 @@ function getFilenamePrefix(lhr) {
29
28
  dateParts.unshift(dateParts.pop());
30
29
  const dateStr = dateParts.join('-');
31
30
 
32
- const filenamePrefix = `${hostname}_${dateStr}_${timeStr}`;
31
+ const filenamePrefix = `${name}_${dateStr}_${timeStr}`;
33
32
  // replace characters that are unfriendly to filenames
34
33
  return filenamePrefix.replace(/[/?<>\\:*|"]/g, '-');
35
34
  }
36
35
 
37
- module.exports = {getFilenamePrefix};
36
+ /**
37
+ * Generate a filenamePrefix of hostname_YYYY-MM-DD_HH-MM-SS.
38
+ * @param {{finalUrl: string, fetchTime: string}} lhr
39
+ * @return {string}
40
+ */
41
+ function getLhrFilenamePrefix(lhr) {
42
+ const hostname = new URL(lhr.finalUrl).hostname;
43
+ return getFilenamePrefix(hostname, lhr.fetchTime);
44
+ }
45
+
46
+ module.exports = {getLhrFilenamePrefix, getFilenamePrefix};
@@ -55,7 +55,6 @@ class ReportGenerator {
55
55
  return ReportGenerator.replaceStrings(htmlReportAssets.REPORT_TEMPLATE, [
56
56
  {search: '%%LIGHTHOUSE_JSON%%', replacement: sanitizedJson},
57
57
  {search: '%%LIGHTHOUSE_JAVASCRIPT%%', replacement: sanitizedJavascript},
58
- {search: '/*%%LIGHTHOUSE_CSS%%*/', replacement: htmlReportAssets.REPORT_CSS},
59
58
  ]);
60
59
  }
61
60
 
@@ -333,7 +333,6 @@ export class CategoryRenderer {
333
333
  renderScoreGauge(category, groupDefinitions) { // eslint-disable-line no-unused-vars
334
334
  const tmpl = this.dom.createComponent('gauge');
335
335
  const wrapper = this.dom.find('a.lh-gauge__wrapper', tmpl);
336
- this.dom.safelySetHref(wrapper, `#${category.id}`);
337
336
 
338
337
  if (Util.isPluginCategory(category.id)) {
339
338
  wrapper.classList.add('lh-gauge__wrapper--plugin');
@@ -374,14 +373,13 @@ export class CategoryRenderer {
374
373
  renderCategoryFraction(category) {
375
374
  const tmpl = this.dom.createComponent('fraction');
376
375
  const wrapper = this.dom.find('a.lh-fraction__wrapper', tmpl);
377
- this.dom.safelySetHref(wrapper, `#${category.id}`);
378
376
 
379
- const {numPassed, numAudits, totalWeight} = Util.calculateCategoryFraction(category);
377
+ const {numPassed, numPassableAudits, totalWeight} = Util.calculateCategoryFraction(category);
380
378
 
381
- const fraction = numPassed / numAudits;
379
+ const fraction = numPassed / numPassableAudits;
382
380
  const content = this.dom.find('.lh-fraction__content', tmpl);
383
381
  const text = this.dom.createElement('span');
384
- text.textContent = `${numPassed}/${numAudits}`;
382
+ text.textContent = `${numPassed}/${numPassableAudits}`;
385
383
  content.appendChild(text);
386
384
 
387
385
  let rating = Util.calculateRating(fraction);
@@ -485,7 +483,7 @@ export class CategoryRenderer {
485
483
  */
486
484
  render(category, groupDefinitions = {}, options) {
487
485
  const element = this.dom.createElement('div', 'lh-category');
488
- this.createPermalinkSpan(element, category.id);
486
+ element.id = category.id;
489
487
  element.appendChild(this.renderCategoryHeader(category, groupDefinitions, options));
490
488
 
491
489
  // Top level clumps for audits, in order they will appear in the report.
@@ -523,14 +521,4 @@ export class CategoryRenderer {
523
521
 
524
522
  return element;
525
523
  }
526
-
527
- /**
528
- * Create a non-semantic span used for hash navigation of categories
529
- * @param {Element} element
530
- * @param {string} id
531
- */
532
- createPermalinkSpan(element, id) {
533
- const permalinkEl = this.dom.createChildOf(element, 'span', 'lh-permalink');
534
- permalinkEl.id = id;
535
- }
536
524
  }