lighthouse 8.5.1 → 8.6.0-dev.20211016

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 (173) hide show
  1. package/changelog.md +5490 -0
  2. package/dist/report/flow.js +35 -12
  3. package/dist/report/standalone.js +20 -21
  4. package/flow-report/.eslintrc.cjs +49 -0
  5. package/flow-report/assets/styles.css +272 -9
  6. package/flow-report/jest.config.js +1 -1
  7. package/flow-report/package.json +4 -0
  8. package/flow-report/src/app.tsx +31 -9
  9. package/flow-report/src/common.tsx +86 -7
  10. package/flow-report/src/header.tsx +88 -0
  11. package/flow-report/src/help-dialog.tsx +120 -0
  12. package/flow-report/src/i18n/i18n.tsx +52 -0
  13. package/flow-report/src/i18n/localized-strings.js +11 -0
  14. package/flow-report/src/i18n/ui-strings.js +134 -0
  15. package/flow-report/src/icons.tsx +20 -3
  16. package/flow-report/src/sidebar/sidebar.tsx +11 -16
  17. package/flow-report/src/summary/category.tsx +39 -24
  18. package/flow-report/src/summary/summary.tsx +35 -32
  19. package/flow-report/src/topbar.tsx +54 -4
  20. package/flow-report/src/util.ts +26 -1
  21. package/flow-report/src/wrappers/report-renderer.tsx +1 -1
  22. package/flow-report/src/wrappers/report.tsx +6 -21
  23. package/flow-report/test/app-test.tsx +17 -13
  24. package/flow-report/test/common-test.tsx +89 -0
  25. package/flow-report/test/header-test.tsx +55 -0
  26. package/flow-report/test/sample-flow.ts +17 -0
  27. package/flow-report/test/setup/env-setup.ts +1 -0
  28. package/flow-report/test/sidebar/flow-test.tsx +6 -12
  29. package/flow-report/test/sidebar/sidebar-test.tsx +7 -13
  30. package/flow-report/test/summary/category-test.tsx +83 -34
  31. package/flow-report/test/summary/summary-test.tsx +12 -18
  32. package/flow-report/test/topbar-test.tsx +68 -0
  33. package/flow-report/test/util-test.tsx +1 -12
  34. package/flow-report/tsconfig.json +2 -0
  35. package/flow-report/types/flow-report.d.ts +2 -1
  36. package/jest.config.js +1 -15
  37. package/lighthouse-cli/bin.js +5 -0
  38. package/lighthouse-cli/cli-flags.js +10 -3
  39. package/lighthouse-cli/commands/commands.js +1 -0
  40. package/lighthouse-cli/commands/list-locales.js +16 -0
  41. package/lighthouse-cli/run.js +2 -2
  42. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
  43. package/lighthouse-cli/test/smokehouse/report-assert.js +20 -4
  44. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +2 -1
  45. package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
  46. package/lighthouse-core/audits/seo/crawlable-anchors.js +10 -12
  47. package/lighthouse-core/computed/js-bundles.js +1 -2
  48. package/lighthouse-core/computed/unused-javascript-summary.js +3 -3
  49. package/lighthouse-core/config/config-helpers.js +1 -0
  50. package/lighthouse-core/config/config.js +2 -2
  51. package/lighthouse-core/config/default-config.js +5 -0
  52. package/lighthouse-core/fraggle-rock/api.js +10 -0
  53. package/lighthouse-core/fraggle-rock/config/filters.js +22 -3
  54. package/lighthouse-core/fraggle-rock/gather/driver.js +4 -0
  55. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -2
  56. package/lighthouse-core/fraggle-rock/user-flow.js +35 -6
  57. package/lighthouse-core/gather/driver/navigation.js +5 -0
  58. package/lighthouse-core/gather/driver/prepare.js +14 -0
  59. package/lighthouse-core/gather/driver/storage.js +5 -0
  60. package/lighthouse-core/gather/gather-runner.js +2 -2
  61. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +5 -1
  62. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +30 -24
  63. package/lighthouse-core/lib/cdt/Platform.js +55 -0
  64. package/lighthouse-core/lib/cdt/SDK.js +3 -123
  65. package/lighthouse-core/lib/cdt/generated/SourceMap.js +148 -312
  66. package/lighthouse-core/lib/csp-evaluator.js +2 -1
  67. package/lighthouse-core/lib/i18n/README.md +6 -6
  68. package/lighthouse-core/lib/i18n/i18n.js +26 -348
  69. package/lighthouse-core/lib/page-functions.js +4 -4
  70. package/lighthouse-core/lib/stack-packs.js +1 -13
  71. package/lighthouse-core/runner.js +6 -6
  72. package/lighthouse-core/scripts/manual-chrome-launcher.js +4 -1
  73. package/lighthouse-core/scripts/package.json +4 -0
  74. package/lighthouse-core/util-commonjs.js +20 -4
  75. package/package.json +19 -16
  76. package/readme.md +1 -1
  77. package/report/assets/standalone-template.html +0 -1
  78. package/report/assets/styles.css +16 -41
  79. package/report/assets/templates.html +42 -4
  80. package/report/clients/psi.js +1 -0
  81. package/report/clients/standalone.js +1 -2
  82. package/report/generator/file-namer.js +17 -8
  83. package/report/generator/report-generator.js +0 -1
  84. package/report/renderer/category-renderer.js +4 -16
  85. package/report/renderer/components.js +107 -71
  86. package/report/renderer/dom.js +19 -0
  87. package/report/renderer/logger.js +35 -2
  88. package/report/renderer/performance-category-renderer.js +23 -21
  89. package/report/renderer/pwa-category-renderer.js +1 -2
  90. package/report/renderer/report-renderer.js +21 -0
  91. package/report/renderer/report-ui-features.js +7 -19
  92. package/report/renderer/swap-locale-feature.js +82 -0
  93. package/report/renderer/util.js +20 -4
  94. package/report/test/clients/psi-test.js +0 -4
  95. package/report/test/generator/file-namer-test.js +2 -2
  96. package/report/test/renderer/category-renderer-test.js +1 -1
  97. package/report/test/renderer/performance-category-renderer-test.js +12 -0
  98. package/report/test/renderer/report-renderer-axe-test.js +86 -0
  99. package/report/test/renderer/report-renderer-test.js +0 -55
  100. package/report/test/renderer/util-test.js +68 -8
  101. package/report/test-assets/faux-psi-template.html +0 -1
  102. package/report/tsconfig.json +2 -1
  103. package/report/types/html-renderer.d.ts +2 -1
  104. package/root.js +18 -0
  105. package/shared/localization/format.js +455 -0
  106. package/{lighthouse-core/lib/cdt/Common.js → shared/localization/i18n-module.js} +3 -8
  107. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar-XB.json +139 -4
  108. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar.json +141 -6
  109. package/{lighthouse-core/lib/i18n → shared/localization}/locales/bg.json +139 -4
  110. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ca.json +140 -5
  111. package/{lighthouse-core/lib/i18n → shared/localization}/locales/cs.json +139 -4
  112. package/{lighthouse-core/lib/i18n → shared/localization}/locales/da.json +139 -4
  113. package/{lighthouse-core/lib/i18n → shared/localization}/locales/de.json +139 -4
  114. package/{lighthouse-core/lib/i18n → shared/localization}/locales/el.json +141 -6
  115. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-GB.json +139 -4
  116. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-US.json +129 -0
  117. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XA.json +139 -4
  118. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XL.json +129 -0
  119. package/{lighthouse-core/lib/i18n → shared/localization}/locales/es-419.json +139 -4
  120. package/{lighthouse-core/lib/i18n → shared/localization}/locales/es.json +139 -4
  121. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fi.json +139 -4
  122. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fil.json +139 -4
  123. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fr.json +139 -4
  124. package/{lighthouse-core/lib/i18n → shared/localization}/locales/he.json +139 -4
  125. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hi.json +142 -7
  126. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hr.json +139 -4
  127. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hu.json +139 -4
  128. package/{lighthouse-core/lib/i18n → shared/localization}/locales/id.json +139 -4
  129. package/{lighthouse-core/lib/i18n → shared/localization}/locales/it.json +139 -4
  130. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ja.json +139 -4
  131. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ko.json +139 -4
  132. package/{lighthouse-core/lib/i18n → shared/localization}/locales/lt.json +139 -4
  133. package/{lighthouse-core/lib/i18n → shared/localization}/locales/lv.json +139 -4
  134. package/{lighthouse-core/lib/i18n → shared/localization}/locales/nl.json +139 -4
  135. package/{lighthouse-core/lib/i18n → shared/localization}/locales/no.json +139 -4
  136. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pl.json +139 -4
  137. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt-PT.json +139 -4
  138. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt.json +139 -4
  139. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ro.json +139 -4
  140. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ru.json +139 -4
  141. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sk.json +139 -4
  142. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sl.json +139 -4
  143. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr-Latn.json +139 -4
  144. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr.json +139 -4
  145. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sv.json +139 -4
  146. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ta.json +146 -11
  147. package/{lighthouse-core/lib/i18n → shared/localization}/locales/te.json +179 -44
  148. package/{lighthouse-core/lib/i18n → shared/localization}/locales/th.json +139 -4
  149. package/{lighthouse-core/lib/i18n → shared/localization}/locales/tr.json +139 -4
  150. package/{lighthouse-core/lib/i18n → shared/localization}/locales/uk.json +139 -4
  151. package/{lighthouse-core/lib/i18n → shared/localization}/locales/vi.json +139 -4
  152. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-HK.json +139 -4
  153. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-TW.json +139 -4
  154. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh.json +139 -4
  155. package/{lighthouse-core/lib/i18n → shared/localization}/locales.js +8 -1
  156. package/shared/localization/swap-flow-locale.js +20 -0
  157. package/{lighthouse-core/lib/i18n → shared/localization}/swap-locale.js +9 -7
  158. package/shared/test/localization/format-test.js +421 -0
  159. package/shared/test/localization/locales-test.js +47 -0
  160. package/shared/test/localization/swap-locale-test.js +140 -0
  161. package/shared/tsconfig.json +22 -0
  162. package/{lighthouse-core/lib → shared}/type-verifiers.js +0 -0
  163. package/shared/types/shared.d.ts +24 -0
  164. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +5 -3
  165. package/third-party/chromium-synchronization/installability-errors-test.js +2 -1
  166. package/tsconfig-all.json +1 -0
  167. package/tsconfig-base.json +1 -1
  168. package/tsconfig.json +2 -3
  169. package/types/config.d.ts +1 -0
  170. package/types/es-main.d.ts +18 -0
  171. package/types/externs.d.ts +2 -0
  172. package/types/lhr/flow.d.ts +7 -0
  173. package/types/lhr/i18n.d.ts +0 -3
@@ -7,7 +7,7 @@
7
7
 
8
8
  const fs = require('fs');
9
9
  const fetch = require('node-fetch');
10
- const {LH_ROOT} = require('../../../root.js');
10
+ const {LH_ROOT} = require('../../root.js');
11
11
 
12
12
  const inspectorIssuesGathererPath = LH_ROOT +
13
13
  '/lighthouse-core/gather/gatherers/inspector-issues.js';
@@ -31,7 +31,8 @@ describe('issueAdded types', () => {
31
31
  .sort();
32
32
  });
33
33
 
34
- it('should notify us if something changed', () => {
34
+ // TODO: https://github.com/GoogleChrome/lighthouse/issues/13147
35
+ it.skip('should notify us if something changed', () => {
35
36
  expect(inspectorIssueDetailsTypes).toMatchInlineSnapshot(`
36
37
  Array [
37
38
  "blockedByResponseIssueDetails",
@@ -44,7 +45,8 @@ describe('issueAdded types', () => {
44
45
  `);
45
46
  });
46
47
 
47
- it('are each handled explicitly in the gatherer', () => {
48
+ // TODO: https://github.com/GoogleChrome/lighthouse/issues/13147
49
+ it.skip('are each handled explicitly in the gatherer', () => {
48
50
  // Regex relies on the typecasts
49
51
  const sourceTypeMatches = inspectorIssuesGathererSource.matchAll(
50
52
  /LH\.Crdp\.Audits\.(.*?Details)>/g
@@ -74,7 +74,8 @@ Array [
74
74
  `);
75
75
  });
76
76
 
77
- it('are each handled explicitly in the gatherer', () => {
77
+ // TODO: https://github.com/GoogleChrome/lighthouse/issues/13147
78
+ it.skip('are each handled explicitly in the gatherer', () => {
78
79
  const errorStrings = Object.keys(InstallableManifestAudit.UIStrings)
79
80
  .filter(key => chromiumErrorIds.includes(key))
80
81
  .sort();
package/tsconfig-all.json CHANGED
@@ -9,6 +9,7 @@
9
9
  {"path": "./lighthouse-viewer/"},
10
10
  {"path": "./lighthouse-treemap/"},
11
11
  {"path": "./flow-report/"},
12
+ {"path": "./shared/"},
12
13
  ],
13
14
  "files": [],
14
15
  "include": [],
@@ -19,6 +19,6 @@
19
19
 
20
20
  // "listFiles": true,
21
21
  // "noErrorTruncation": true,
22
- "extendedDiagnostics": true,
22
+ // "extendedDiagnostics": true,
23
23
  },
24
24
  }
package/tsconfig.json CHANGED
@@ -10,6 +10,7 @@
10
10
  {"path": "./types/lhr/"},
11
11
  {"path": "./report/"},
12
12
  {"path": "./report/generator/"},
13
+ {"path": "./shared/"},
13
14
  ],
14
15
  "include": [
15
16
  "root.js",
@@ -22,13 +23,13 @@
22
23
 
23
24
  // TODO(esmodules): JSON files included via resolveJsonModule. Removable on the switch to ES Modules.
24
25
  "package.json",
25
- "lighthouse-core/lib/i18n/locales/en-US.json",
26
26
  "lighthouse-core/test/results/sample_v2.json",
27
27
  "lighthouse-core/lib/sd-validation/assets/*.json",
28
28
  "lighthouse-core/test/fixtures/unresolved-perflog.json",
29
29
  "lighthouse-core/test/fixtures/traces/lcp-m78.devtools.log.json",
30
30
  "third-party/snyk/snapshot.json",
31
31
  "lighthouse-core/audits/byte-efficiency/polyfill-graph-data.json",
32
+ "shared/localization/locales/en-US.json",
32
33
  ],
33
34
  "exclude": [
34
35
  "lighthouse-core/test/audits/**/*.js",
@@ -79,8 +80,6 @@
79
80
  "lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js",
80
81
  "lighthouse-core/test/lib/emulation-test.js",
81
82
  "lighthouse-core/test/lib/i18n/i18n-test.js",
82
- "lighthouse-core/test/lib/i18n/locales-test.js",
83
- "lighthouse-core/test/lib/i18n/swap-locale-test.js",
84
83
  "lighthouse-core/test/lib/icons-test.js",
85
84
  "lighthouse-core/test/lib/lh-element-test.js",
86
85
  "lighthouse-core/test/lib/manifest-parser-test.js",
package/types/config.d.ts CHANGED
@@ -134,6 +134,7 @@ declare module Config {
134
134
  auditRefs: AuditRefJson[];
135
135
  description?: string | IcuMessage;
136
136
  manualDescription?: string | IcuMessage;
137
+ supportedModes?: Gatherer.GatherMode[];
137
138
  }
138
139
 
139
140
  interface GroupJson {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
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
+ */
6
+
7
+ /**
8
+ * @fileoverview Types for the `es-main` npm module.
9
+ */
10
+
11
+ /**
12
+ * Test if an ES module is run directly with Node.js.
13
+ * @param importMeta `import.meta`
14
+ */
15
+ declare function esMain(importMeta: ImportMeta): boolean;
16
+ declare module 'es-main' {
17
+ export = esMain;
18
+ }
@@ -155,6 +155,8 @@ export interface CliFlags extends Flags {
155
155
  enableErrorReporting?: boolean;
156
156
  /** Flag to print a list of all audits + categories. */
157
157
  listAllAudits: boolean;
158
+ /** Flag to print a list of all supported locales. */
159
+ listLocales: boolean;
158
160
  /** Flag to print a list of all required trace categories. */
159
161
  listTraceCategories: boolean;
160
162
  /** A preset audit of selected audit categories to run. */
@@ -11,6 +11,11 @@ declare module FlowResult {
11
11
  lhr: Result;
12
12
  name: string;
13
13
  }
14
+
15
+ interface LhrRef {
16
+ value: Result;
17
+ index: number;
18
+ }
14
19
  }
15
20
 
16
21
  /**
@@ -19,6 +24,8 @@ declare module FlowResult {
19
24
  interface FlowResult {
20
25
  /** Ordered list of flow steps, each corresponding to a navigation, timespan, or snapshot. */
21
26
  steps: FlowResult.Step[];
27
+ /** Name given to this user flow. */
28
+ name: string;
22
29
  }
23
30
 
24
31
  export default FlowResult;
@@ -4,9 +4,6 @@
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
- // TODO(bckenny): i18n types should not be necessary for the LHR, but too difficult
8
- // to unravel from audit-details right now.
9
-
10
7
  export type IcuMessage = {
11
8
  // NOTE: `i18nId` rather than just `id` to make tsc typing easier (vs type branding which won't survive JSON roundtrip).
12
9
  /** The id locating this message in the locale message json files. */