lighthouse 8.3.0-dev.20210907 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/changelog.md +1 -1
  2. package/dist/report/standalone.js +196 -0
  3. package/jest.config.js +0 -4
  4. package/lighthouse-cli/cli-flags.js +6 -14
  5. package/lighthouse-cli/run.js +1 -1
  6. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +3 -9
  7. package/lighthouse-cli/test/smokehouse/report-assert.js +16 -36
  8. package/lighthouse-core/audits/large-javascript-libraries.js +166 -0
  9. package/lighthouse-core/audits/seo/http-status-code.js +6 -2
  10. package/lighthouse-core/audits/viewport.js +1 -2
  11. package/lighthouse-core/config/config-helpers.js +75 -9
  12. package/lighthouse-core/config/config.js +50 -6
  13. package/lighthouse-core/config/constants.js +0 -1
  14. package/lighthouse-core/config/default-config.js +0 -3
  15. package/lighthouse-core/config/experimental-config.js +8 -0
  16. package/lighthouse-core/config/metrics-to-audits.js +0 -1
  17. package/lighthouse-core/fraggle-rock/config/config.js +4 -3
  18. package/lighthouse-core/fraggle-rock/config/default-config.js +1 -3
  19. package/lighthouse-core/fraggle-rock/config/validation.js +0 -201
  20. package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +0 -4
  21. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +8 -16
  22. package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +0 -4
  23. package/lighthouse-core/fraggle-rock/gather/session.js +5 -30
  24. package/lighthouse-core/gather/driver/navigation.js +6 -7
  25. package/lighthouse-core/gather/driver/wait-for-condition.js +0 -27
  26. package/lighthouse-core/gather/fetcher.js +7 -17
  27. package/lighthouse-core/gather/gather-runner.js +0 -1
  28. package/lighthouse-core/gather/gatherers/seo/robots-txt.js +6 -2
  29. package/lighthouse-core/gather/gatherers/seo/tap-targets.js +2 -2
  30. package/lighthouse-core/gather/gatherers/stacks.js +1 -1
  31. package/lighthouse-core/lib/asset-saver.js +2 -2
  32. package/lighthouse-core/lib/cdt/SDK.js +0 -1
  33. package/lighthouse-core/lib/csp-evaluator.js +4 -17
  34. package/{report/generator → lighthouse-core/lib}/file-namer.js +0 -0
  35. package/lighthouse-core/lib/i18n/README.md +1 -1
  36. package/lighthouse-core/lib/i18n/i18n.js +7 -7
  37. package/lighthouse-core/lib/i18n/locales/ar-XB.json +18 -0
  38. package/lighthouse-core/lib/i18n/locales/ar.json +18 -0
  39. package/lighthouse-core/lib/i18n/locales/bg.json +18 -0
  40. package/lighthouse-core/lib/i18n/locales/ca.json +18 -0
  41. package/lighthouse-core/lib/i18n/locales/cs.json +18 -0
  42. package/lighthouse-core/lib/i18n/locales/da.json +18 -0
  43. package/lighthouse-core/lib/i18n/locales/de.json +18 -0
  44. package/lighthouse-core/lib/i18n/locales/el.json +18 -0
  45. package/lighthouse-core/lib/i18n/locales/en-GB.json +18 -0
  46. package/lighthouse-core/lib/i18n/locales/en-US.json +18 -18
  47. package/lighthouse-core/lib/i18n/locales/en-XA.json +18 -0
  48. package/lighthouse-core/lib/i18n/locales/en-XL.json +18 -18
  49. package/lighthouse-core/lib/i18n/locales/es-419.json +18 -0
  50. package/lighthouse-core/lib/i18n/locales/es.json +18 -0
  51. package/lighthouse-core/lib/i18n/locales/fi.json +18 -0
  52. package/lighthouse-core/lib/i18n/locales/fil.json +18 -0
  53. package/lighthouse-core/lib/i18n/locales/fr.json +18 -0
  54. package/lighthouse-core/lib/i18n/locales/he.json +18 -0
  55. package/lighthouse-core/lib/i18n/locales/hi.json +18 -0
  56. package/lighthouse-core/lib/i18n/locales/hr.json +18 -0
  57. package/lighthouse-core/lib/i18n/locales/hu.json +18 -0
  58. package/lighthouse-core/lib/i18n/locales/id.json +18 -0
  59. package/lighthouse-core/lib/i18n/locales/it.json +18 -0
  60. package/lighthouse-core/lib/i18n/locales/ja.json +18 -0
  61. package/lighthouse-core/lib/i18n/locales/ko.json +18 -0
  62. package/lighthouse-core/lib/i18n/locales/lt.json +18 -0
  63. package/lighthouse-core/lib/i18n/locales/lv.json +18 -0
  64. package/lighthouse-core/lib/i18n/locales/nl.json +18 -0
  65. package/lighthouse-core/lib/i18n/locales/no.json +18 -0
  66. package/lighthouse-core/lib/i18n/locales/pl.json +18 -0
  67. package/lighthouse-core/lib/i18n/locales/pt-PT.json +18 -0
  68. package/lighthouse-core/lib/i18n/locales/pt.json +18 -0
  69. package/lighthouse-core/lib/i18n/locales/ro.json +18 -0
  70. package/lighthouse-core/lib/i18n/locales/ru.json +18 -0
  71. package/lighthouse-core/lib/i18n/locales/sk.json +18 -0
  72. package/lighthouse-core/lib/i18n/locales/sl.json +18 -0
  73. package/lighthouse-core/lib/i18n/locales/sr-Latn.json +18 -0
  74. package/lighthouse-core/lib/i18n/locales/sr.json +18 -0
  75. package/lighthouse-core/lib/i18n/locales/sv.json +18 -0
  76. package/lighthouse-core/lib/i18n/locales/ta.json +18 -0
  77. package/lighthouse-core/lib/i18n/locales/te.json +18 -0
  78. package/lighthouse-core/lib/i18n/locales/th.json +18 -0
  79. package/lighthouse-core/lib/i18n/locales/tr.json +18 -0
  80. package/lighthouse-core/lib/i18n/locales/uk.json +18 -0
  81. package/lighthouse-core/lib/i18n/locales/vi.json +18 -0
  82. package/lighthouse-core/lib/i18n/locales/zh-HK.json +18 -0
  83. package/lighthouse-core/lib/i18n/locales/zh-TW.json +18 -0
  84. package/lighthouse-core/lib/i18n/locales/zh.json +18 -0
  85. package/lighthouse-core/lib/large-javascript-libraries/bundlephobia-database.json +62 -0
  86. package/lighthouse-core/lib/large-javascript-libraries/library-suggestions.js +20 -0
  87. package/lighthouse-core/lib/network-request.js +1 -3
  88. package/lighthouse-core/lib/traces/pwmetrics-events.js +2 -2
  89. package/lighthouse-core/lib/url-shim.js +1 -7
  90. package/lighthouse-core/runner.js +1 -4
  91. package/lighthouse-core/util-commonjs.js +2 -2
  92. package/now.json +1 -1
  93. package/package.json +13 -20
  94. package/report/README.md +2 -2
  95. package/report/assets/standalone-template.html +1 -0
  96. package/report/assets/styles.css +27 -23
  97. package/report/assets/templates.html +40 -37
  98. package/report/clients/bundle.js +0 -1
  99. package/report/{package.json → clients/package.json} +0 -0
  100. package/report/clients/psi.js +3 -13
  101. package/report/clients/standalone.js +1 -1
  102. package/report/{types/buffer.d.ts → clients/treemap.js} +13 -11
  103. package/report/renderer/category-renderer.js +2 -2
  104. package/report/renderer/components.js +48 -46
  105. package/report/renderer/crc-details-renderer.js +16 -16
  106. package/report/renderer/details-renderer.js +1 -1
  107. package/report/renderer/dom.js +0 -17
  108. package/report/renderer/element-screenshot-renderer.js +9 -9
  109. package/{flow-report/test/setup/global-setup.ts → report/renderer/file-namer.js} +2 -5
  110. package/report/renderer/logger.js +4 -4
  111. package/report/renderer/package.json +4 -0
  112. package/report/renderer/report-renderer.js +11 -4
  113. package/report/renderer/report-ui-features.js +656 -43
  114. package/report/renderer/text-encoding.js +1 -1
  115. package/report/renderer/util.js +2 -2
  116. package/report/{generator/report-assets.js → report-assets.js} +3 -9
  117. package/report/{generator/report-generator.js → report-generator.js} +9 -37
  118. package/report/test/clients/package.json +4 -0
  119. package/report/test/clients/psi-test.js +1 -3
  120. package/report/test/renderer/category-renderer-test.js +3 -8
  121. package/report/test/renderer/components-test.js +0 -35
  122. package/report/test/renderer/crc-details-renderer-test.js +4 -5
  123. package/report/test/renderer/details-renderer-test.js +1 -3
  124. package/report/test/renderer/dom-test.js +6 -8
  125. package/report/test/renderer/i18n-test.js +0 -1
  126. package/report/test/renderer/package.json +4 -0
  127. package/report/test/renderer/performance-category-renderer-test.js +27 -30
  128. package/report/test/renderer/pwa-category-renderer-test.js +1 -2
  129. package/report/test/renderer/report-renderer-test.js +0 -1
  130. package/report/test/renderer/report-ui-features-test.js +28 -20
  131. package/report/test/renderer/snippet-renderer-test.js +0 -1
  132. package/report/test/renderer/text-encoding-test.js +0 -2
  133. package/report/test/renderer/util-test.js +0 -1
  134. package/report/test/{generator/report-generator-test.js → report-generator-test.js} +7 -9
  135. package/third-party/chromium-synchronization/installability-errors-test.js +27 -28
  136. package/third-party/snyk/snapshot.json +0 -2
  137. package/tsconfig.json +5 -24
  138. package/types/artifacts.d.ts +18 -5
  139. package/types/{lhr/audit-details.d.ts → audit-details.d.ts} +3 -18
  140. package/types/audit.d.ts +58 -7
  141. package/types/{lhr/budget.d.ts → budget.d.ts} +0 -0
  142. package/types/bundle-phobia-cli/index.d.ts +40 -0
  143. package/types/config.d.ts +8 -3
  144. package/types/externs.d.ts +119 -5
  145. package/types/gatherer.d.ts +2 -3
  146. package/types/global-lh.d.ts +14 -16
  147. package/{report/types/report-result.d.ts → types/html-renderer.d.ts} +17 -8
  148. package/types/{lhr/i18n.d.ts → i18n.d.ts} +25 -2
  149. package/types/{lhr/lhr.d.ts → lhr.d.ts} +9 -41
  150. package/types/smokehouse.d.ts +3 -3
  151. package/types/{lhr/treemap.d.ts → treemap.d.ts} +3 -3
  152. package/flow-report/assets/standalone-flow-template.html +0 -38
  153. package/flow-report/assets/styles.css +0 -310
  154. package/flow-report/jest.config.js +0 -24
  155. package/flow-report/src/app.tsx +0 -40
  156. package/flow-report/src/common.tsx +0 -72
  157. package/flow-report/src/icons.tsx +0 -96
  158. package/flow-report/src/sidebar/flow.tsx +0 -72
  159. package/flow-report/src/sidebar/sidebar.tsx +0 -89
  160. package/flow-report/src/summary/summary.tsx +0 -178
  161. package/flow-report/src/util.ts +0 -160
  162. package/flow-report/src/wrappers/gauge.tsx +0 -40
  163. package/flow-report/src/wrappers/report-renderer.tsx +0 -46
  164. package/flow-report/src/wrappers/report.tsx +0 -71
  165. package/flow-report/standalone-flow.tsx +0 -23
  166. package/flow-report/test/app-test.tsx +0 -48
  167. package/flow-report/test/common-test.tsx +0 -131
  168. package/flow-report/test/setup/env-setup.ts +0 -25
  169. package/flow-report/test/sidebar/flow-test.tsx +0 -71
  170. package/flow-report/test/sidebar/sidebar-test.tsx +0 -53
  171. package/flow-report/test/summary/summary-test.tsx +0 -132
  172. package/flow-report/test/util-test.tsx +0 -109
  173. package/flow-report/tsconfig.json +0 -39
  174. package/flow-report/types/flow-report.d.ts +0 -27
  175. package/lighthouse-core/audits/lcp-lazy-loaded.js +0 -83
  176. package/report/.eslintrc.cjs +0 -33
  177. package/report/generator/README.md +0 -9
  178. package/report/generator/flow-report-assets.js +0 -20
  179. package/report/generator/package.json +0 -4
  180. package/report/generator/tsconfig.json +0 -28
  181. package/report/renderer/drop-down-menu.js +0 -215
  182. package/report/renderer/features-util.js +0 -26
  183. package/report/renderer/open-tab.js +0 -137
  184. package/report/renderer/topbar-features.js +0 -309
  185. package/report/test/generator/file-namer-test.js +0 -28
  186. package/report/test/generator/package.json +0 -4
  187. package/report/test-assets/faux-psi-template.html +0 -126
  188. package/report/test-assets/faux-psi.js +0 -92
  189. package/report/tsconfig.json +0 -39
  190. package/report/types/augment-dom.d.ts +0 -24
  191. package/report/types/html-renderer.d.ts +0 -28
  192. package/types/lhr/audit-result.d.ts +0 -59
  193. package/types/lhr/flow.d.ts +0 -16
  194. package/types/lhr/settings.d.ts +0 -105
  195. package/types/lhr/tsconfig.json +0 -24
  196. package/types/query-selector.d.ts +0 -36
@@ -7,26 +7,24 @@
7
7
  import ArbitraryEqualityMap_ = require('../lighthouse-core/lib/arbitrary-equality-map.js');
8
8
  import * as Artifacts_ from './artifacts';
9
9
  import Audit_ from './audit';
10
- import Budget_ from './lhr/budget';
10
+ import Budget_ from './budget';
11
11
  import Config_ from './config';
12
12
  import _Crdp from 'devtools-protocol/types/protocol';
13
13
  import _CrdpMappings from 'devtools-protocol/types/protocol-mapping';
14
14
  import * as Externs from './externs';
15
15
  import Gatherer_ from './gatherer';
16
- import * as I18n from './lhr/i18n';
16
+ import * as I18n from './i18n';
17
17
  import LHError = require('../lighthouse-core/lib/lh-error.js');
18
- import LHResult from './lhr/lhr';
19
- import FlowResult_ from './lhr/flow';
18
+ import LHResult from './lhr';
20
19
  import Protocol_ from './protocol';
21
- import * as Settings from './lhr/settings';
20
+ import ReportResult_ from './html-renderer';
22
21
  import StructuredData_ from './structured-data';
23
- import Treemap_ from './lhr/treemap';
22
+ import Treemap_ from './treemap';
24
23
 
25
24
  // Construct hierarchy of global types under the LH namespace.
26
25
  declare global {
27
26
  module LH {
28
27
  export type ArbitraryEqualityMap = ArbitraryEqualityMap_;
29
- export type FlowResult = FlowResult_;
30
28
 
31
29
  // artifacts.d.ts
32
30
  export import Artifacts = Artifacts_.Artifacts;
@@ -47,6 +45,11 @@ declare global {
47
45
  export import CrdpCommands = _CrdpMappings.Commands;
48
46
 
49
47
  // externs.d.ts
48
+ export import ThrottlingSettings = Externs.ThrottlingSettings;
49
+ export import ScreenEmulationSettings = Externs.ScreenEmulationSettings;
50
+ export import SharedFlagsSettings = Externs.SharedFlagsSettings;
51
+ export import OutputMode = Externs.OutputMode;
52
+ export import PrecomputedLanternData = Externs.PrecomputedLanternData;
50
53
  export import Flags = Externs.Flags;
51
54
  export import CliFlags = Externs.CliFlags;
52
55
  export import RunnerResult = Externs.RunnerResult;
@@ -57,20 +60,15 @@ declare global {
57
60
  export import Result = LHResult;
58
61
 
59
62
  // i18n.d.ts.
63
+ export import Locale = I18n.Locale;
60
64
  export import IcuMessage = I18n.IcuMessage;
61
65
  export import RawIcu = I18n.RawIcu;
62
66
  export import FormattedIcu = I18n.FormattedIcu;
67
+ export import IcuMessagePaths = I18n.IcuMessagePaths;
68
+ export import I18NRendererStrings = I18n.I18NRendererStrings;
63
69
 
64
70
  export import Protocol = Protocol_;
65
-
66
- // lhr/settings.d.ts
67
- export import Locale = Settings.Locale;
68
- export import ThrottlingSettings = Settings.ThrottlingSettings;
69
- export import ScreenEmulationSettings = Settings.ScreenEmulationSettings;
70
- export import SharedFlagsSettings = Settings.SharedFlagsSettings;
71
- export import OutputMode = Settings.OutputMode;
72
- export import PrecomputedLanternData = Settings.PrecomputedLanternData;
73
-
71
+ export import ReportResult = ReportResult_;
74
72
  export import StructuredData = StructuredData_;
75
73
  export import Treemap = Treemap_;
76
74
  }
@@ -4,24 +4,33 @@
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
6
 
7
- import {Result as AuditResult} from '../../types/lhr/audit-result';
8
- import LHResult from '../../types/lhr/lhr';
7
+ import Audit from './audit';
8
+ import LHResult from './lhr';
9
9
 
10
- /**
11
- * During report generation, the LHR object is transformed a bit for convenience
12
- * Primarily, the auditResult is added as .result onto the auditRef. We're lazy sometimes. It'll be removed in due time.
13
- */
10
+ // Add needed DOM APIs not yet in tsc's lib dom.
11
+ declare global {
12
+ var CompressionStream: {
13
+ prototype: CompressionStream,
14
+ new (format: string): CompressionStream,
15
+ };
16
+
17
+ interface CompressionStream extends GenericTransformStream {
18
+ readonly format: string;
19
+ }
20
+ }
21
+
22
+ // During report generation, the LHR object is transformed a bit for convenience
23
+ // Primarily, the auditResult is added as .result onto the auditRef. We're lazy sometimes. It'll be removed in due time.
14
24
  interface ReportResult extends LHResult {
15
25
  categories: Record<string, ReportResult.Category>;
16
26
  }
17
-
18
27
  declare module ReportResult {
19
28
  interface Category extends LHResult.Category {
20
29
  auditRefs: Array<AuditRef>
21
30
  }
22
31
 
23
32
  interface AuditRef extends LHResult.AuditRef {
24
- result: AuditResult;
33
+ result: Audit.Result;
25
34
  stackPacks?: StackPackDescription[];
26
35
  relevantMetrics?: ReportResult.AuditRef[];
27
36
  }
@@ -4,8 +4,9 @@
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.
7
+ import {Util} from '../report/renderer/util.js';
8
+
9
+ export type Locale = 'en-US'|'en'|'en-AU'|'en-GB'|'en-IE'|'en-SG'|'en-ZA'|'en-IN'|'ar-XB'|'ar'|'bg'|'ca'|'cs'|'da'|'de'|'el'|'en-XA'|'en-XL'|'es'|'es-419'|'es-AR'|'es-BO'|'es-BR'|'es-BZ'|'es-CL'|'es-CO'|'es-CR'|'es-CU'|'es-DO'|'es-EC'|'es-GT'|'es-HN'|'es-MX'|'es-NI'|'es-PA'|'es-PE'|'es-PR'|'es-PY'|'es-SV'|'es-US'|'es-UY'|'es-VE'|'fi'|'fil'|'fr'|'he'|'hi'|'hr'|'hu'|'gsw'|'id'|'in'|'it'|'iw'|'ja'|'ko'|'lt'|'lv'|'mo'|'nl'|'nb'|'no'|'pl'|'pt'|'pt-PT'|'ro'|'ru'|'sk'|'sl'|'sr'|'sr-Latn'|'sv'|'ta'|'te'|'th'|'tl'|'tr'|'uk'|'vi'|'zh'|'zh-HK'|'zh-TW';
9
10
 
10
11
  export type IcuMessage = {
11
12
  // NOTE: `i18nId` rather than just `id` to make tsc typing easier (vs type branding which won't survive JSON roundtrip).
@@ -49,3 +50,25 @@ export type FormattedIcu<T> = T extends IcuMessage ?
49
50
  Exclude<T, IcuMessage> | string :
50
51
  // Otherwise recurse into any properties and repeat.
51
52
  {[K in keyof T]: FormattedIcu<T[K]>};
53
+
54
+ /**
55
+ * Info about an `LH.IcuMessage` value that was localized to a string. Value
56
+ * is either a
57
+ * - path (`_.set()` style) into the original object where the message was replaced
58
+ * - those paths and a set of values that were inserted into the localized strings.
59
+ */
60
+ type IcuMessagePath = string | {path: string, values: Record<string, string | number>};
61
+
62
+ /**
63
+ * A representation of `LH.IcuMessage`s that were in an object (e.g. `LH.Result`)
64
+ * and have been replaced by localized strings. `LH.IcuMessagePaths` provides a
65
+ * mapping that can be used to change the locale of the object again.
66
+ * Keyed by ids from the locale message json files, values are information on
67
+ * how to replace the string if needed.
68
+ */
69
+ export interface IcuMessagePaths {
70
+ [i18nId: string]: IcuMessagePath[];
71
+ }
72
+
73
+ /** Localized strings for the html report renderer. */
74
+ export type I18NRendererStrings = typeof Util['UIStrings'];
@@ -4,15 +4,15 @@
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
6
 
7
- import {Result as AuditResult} from './audit-result';
8
- import {ConfigSettings} from './settings';
7
+ import {Artifacts} from './artifacts';
8
+ import Audit from './audit';
9
+ import Config from './config';
10
+ import {I18NRendererStrings, IcuMessagePaths} from './i18n';
9
11
 
10
12
  /**
11
13
  * The full output of a Lighthouse run.
12
14
  */
13
15
  interface Result {
14
- /** Gather mode used to collect artifacts for this result. */
15
- gatherMode: Result.GatherMode;
16
16
  /** The URL that was supplied to Lighthouse and initially navigated to. */
17
17
  requestedUrl: string;
18
18
  /** The post-redirects URL that Lighthouse loaded. */
@@ -22,14 +22,14 @@ interface Result {
22
22
  /** The version of Lighthouse with which these results were generated. */
23
23
  lighthouseVersion: string;
24
24
  /** An object containing the results of the audits, keyed by the audits' `id` identifier. */
25
- audits: Record<string, AuditResult>;
25
+ audits: Record<string, Audit.Result>;
26
26
  /** The top-level categories, their overall scores, and member audits. */
27
27
  categories: Record<string, Result.Category>;
28
28
  /** Descriptions of the groups referenced by CategoryMembers. */
29
29
  categoryGroups?: Record<string, Result.ReportGroup>;
30
30
 
31
31
  /** The config settings used for these results. */
32
- configSettings: ConfigSettings;
32
+ configSettings: Config.Settings;
33
33
  /** List of top-level warnings for this Lighthouse run. */
34
34
  runWarnings: string[];
35
35
  /** A top-level error message that, if present, indicates a serious enough problem that this Lighthouse result may need to be discarded. */
@@ -40,8 +40,8 @@ interface Result {
40
40
  environment: Result.Environment;
41
41
  /** Execution timings for the Lighthouse run */
42
42
  timing: Result.Timing;
43
- /** Strings for the report and the record of all formatted string locations in the LHR and their corresponding source values. */
44
- i18n: {rendererFormattedStrings: Record<string, string>, icuMessagePaths?: Result.IcuMessagePaths};
43
+ /** The record of all formatted string locations in the LHR and their corresponding source values. */
44
+ i18n: {rendererFormattedStrings: I18NRendererStrings, icuMessagePaths?: IcuMessagePaths};
45
45
  /** An array containing the result of all stack packs. */
46
46
  stackPacks?: Result.StackPack[];
47
47
  }
@@ -60,20 +60,10 @@ declare module Result {
60
60
  }
61
61
 
62
62
  interface Timing {
63
- entries: MeasureEntry[];
63
+ entries: Artifacts.MeasureEntry[];
64
64
  total: number;
65
65
  }
66
66
 
67
- interface MeasureEntry {
68
- // From PerformanceEntry
69
- readonly duration: number;
70
- readonly entryType: string;
71
- readonly name: string;
72
- readonly startTime: number;
73
- /** Whether timing entry was collected during artifact gathering. */
74
- gather?: boolean;
75
- }
76
-
77
67
  interface Category {
78
68
  /** The string identifier of the category. */
79
69
  id: string;
@@ -124,28 +114,6 @@ declare module Result {
124
114
  /** A set of descriptions for some of Lighthouse's audits, keyed by audit `id`. */
125
115
  descriptions: Record<string, string>;
126
116
  }
127
-
128
- /**
129
- * Info about an `LH.IcuMessage` value that was localized to a string when
130
- * included in the LHR. Value is either a
131
- * - path (`_.set()` style) into the original object where the message was replaced
132
- * - those paths and a set of values that were inserted into the localized strings.
133
- */
134
- type IcuMessagePath = string | {path: string, values: Record<string, string | number>};
135
-
136
- /**
137
- * A representation of `LH.IcuMessage`s that were in an object (e.g. `LH.Result`)
138
- * and have been replaced by localized strings. `LH.Result.IcuMessagePaths` provides a
139
- * mapping that can be used to change the locale of the object again.
140
- * Keyed by ids from the locale message json files, values are information on
141
- * how to replace the string if needed.
142
- */
143
- interface IcuMessagePaths {
144
- [i18nId: string]: IcuMessagePath[];
145
- }
146
-
147
- /** Gather mode used to collect artifacts. */
148
- type GatherMode = 'navigation'|'timespan'|'snapshot';
149
117
  }
150
118
 
151
119
  export default Result;
@@ -6,14 +6,14 @@
6
6
 
7
7
  import {Artifacts} from './artifacts';
8
8
  import Config from './config';
9
- import LHResult from './lhr/lhr';
9
+ import LHResult from './lhr';
10
10
 
11
11
  declare global {
12
12
  module Smokehouse {
13
13
  interface ExpectedLHR {
14
14
  audits: Record<string, any>;
15
15
  requestedUrl: string;
16
- finalUrl: string | RegExp;
16
+ finalUrl: string;
17
17
  runWarnings?: Array<string|RegExp>;
18
18
  runtimeError?: {
19
19
  code?: any;
@@ -24,7 +24,7 @@ declare global {
24
24
  export type ExpectedRunnerResult = {
25
25
  lhr: ExpectedLHR,
26
26
  artifacts?: Partial<Record<keyof Artifacts|'_maxChromiumMilestone'|'_minChromiumMilestone', any>>
27
- networkRequests?: {length: number, _legacyOnly?: boolean, _fraggleRockOnly?: boolean};
27
+ networkRequests?: {length: number};
28
28
  }
29
29
 
30
30
  export interface TestDfn {
@@ -4,8 +4,8 @@
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
6
 
7
- import {Result as AuditResult} from './audit-result';
8
- import {Locale} from './settings';
7
+ import Audit from './audit';
8
+ import {Locale} from './i18n';
9
9
 
10
10
  declare module Treemap {
11
11
  interface Options {
@@ -13,7 +13,7 @@ declare module Treemap {
13
13
  requestedUrl: string;
14
14
  finalUrl: string;
15
15
  audits: {
16
- 'script-treemap-data': AuditResult;
16
+ 'script-treemap-data': Audit.Result;
17
17
  };
18
18
  configSettings: {
19
19
  locale: Locale;
@@ -1,38 +0,0 @@
1
- <!--
2
- @license
3
- Copyright 2021 The Lighthouse Authors. All Rights Reserved.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS-IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- -->
17
- <!doctype html>
18
- <html lang="en">
19
- <head>
20
- <meta charset="utf-8">
21
- <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
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
- <title>Lighthouse Flow Report</title>
24
- <style>/*%%LIGHTHOUSE_CSS%%*/</style>
25
- <style>/*%%LIGHTHOUSE_FLOW_CSS%%*/</style>
26
- </head>
27
- <body class="flow-vars lh-root lh-vars">
28
- <noscript>Lighthouse report requires JavaScript. Please enable.</noscript>
29
-
30
- <main><!-- report populated here --></main>
31
-
32
- <script>window.__LIGHTHOUSE_FLOW_JSON__ = %%LIGHTHOUSE_FLOW_JSON%%;</script>
33
- <script>%%LIGHTHOUSE_FLOW_JAVASCRIPT%%
34
- __initLighthouseFlowReport__();
35
- </script>
36
- <script>console.log('window.__LIGHTHOUSE_FLOW_JSON__', __LIGHTHOUSE_FLOW_JSON__);</script>
37
- </body>
38
- </html>
@@ -1,310 +0,0 @@
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
- .flow-vars {
8
- --app-font-size: 12px;
9
- --base-spacing: 16px;
10
- --category-summary-font-size: 18px;
11
- --gather-mode-icon-size: 16px;
12
- --half-base-spacing: calc(var(--base-spacing) / 2);
13
- --sidebar-flow-step-navigation-font-size: 14px;
14
- --sidebar-selected-bg-color: #DDEEFF;
15
- --sidebar-summary-font-size: 14px;
16
- --sidebar-title-font-size: 16px;
17
- --summary-flow-step-label-font-size: 16px;
18
- --summary-subtitle-font-size: 16px;
19
- --summary-title-font-size: 32px;
20
- }
21
-
22
- .App {
23
- display: grid;
24
- grid-template-areas: "side report";
25
- grid-template-columns: min-content auto;
26
- height: 100vh;
27
- max-width: 100vw;
28
- font-size: var(--app-font-size);
29
- }
30
-
31
- .Content {
32
- overflow-y: auto;
33
- }
34
-
35
- .FlowSegment {
36
- height: 100%;
37
- width: var(--gather-mode-icon-size);
38
- display: flex;
39
- flex-direction: column;
40
- align-items: center;
41
- margin: 0 18px;
42
- color: var(--color-blue-A700);
43
- }
44
-
45
- .FlowSegment__top-line, .FlowSegment__bottom-line {
46
- width: 2px;
47
- flex-grow: 1;
48
- background-color: var(--color-blue-A700);
49
- }
50
-
51
- .CategoryRatio {
52
- justify-self: center;
53
- display: flex;
54
- align-items: center;
55
- justify-content: center;
56
- font-size: var(--category-summary-font-size);
57
- min-height: var(--gauge-circle-size);
58
- min-width: var(--gauge-circle-size);
59
- text-decoration: none;
60
- }
61
- .CategoryRatio::before {
62
- content: '';
63
- height: var(--score-icon-size);
64
- width: var(--score-icon-size);
65
- margin: var(--score-icon-margin);
66
- }
67
- .CategoryRatio--pass {
68
- color: var(--color-pass);
69
- }
70
- .CategoryRatio--pass::before {
71
- background-color: var(--color-pass);
72
- border-radius: 50%;
73
- }
74
- .CategoryRatio--average {
75
- color: var(--color-average);
76
- }
77
- .CategoryRatio--average::before {
78
- background-color: var(--color-average);
79
- }
80
- .CategoryRatio--fail {
81
- color: var(--color-fail);
82
- }
83
- .CategoryRatio--fail::before {
84
- border-left: calc(var(--score-icon-size) / 2) solid transparent;
85
- border-right: calc(var(--score-icon-size) / 2) solid transparent;
86
- border-bottom: var(--score-icon-size) solid var(--color-fail);
87
- }
88
- .CategoryRatio--null {
89
- color: var(--color-gray-700);
90
- }
91
- .CategoryRatio--null::before {
92
- border-radius: 50%;
93
- border: 2px solid var(--color-gray-700);
94
- }
95
-
96
- .Separator {
97
- height: 1px;
98
- width: 100%;
99
- background-color: var(--color-gray-300);
100
- }
101
-
102
- .Sidebar {
103
- border-right: 1px solid var(--color-gray-300);
104
- }
105
- .Sidebar a {
106
- color: var(--color-gray-800);
107
- text-decoration: none;
108
- }
109
-
110
- .Sidebar--current {
111
- background-color: var(--sidebar-selected-bg-color);
112
- color: var(--color-blue-A700) !important;
113
- }
114
-
115
- .SidebarHeader {
116
- margin: 26px var(--base-spacing);
117
- }
118
- .SidebarHeader__title {
119
- font-size: var(--sidebar-title-font-size);
120
- font-weight: bold;
121
- width: max-content;
122
- }
123
- .SidebarHeader__date {
124
- color: var(--color-gray-700);
125
- width: max-content;
126
- }
127
-
128
- .SidebarRuntimeSettings {
129
- margin: var(--base-spacing);
130
- padding: var(--half-base-spacing);
131
- background-color: var(--color-gray-50);
132
- border-radius: 3px;
133
- }
134
-
135
- .SidebarRuntimeSettings__item {
136
- display: flex;
137
- align-items: center;
138
- flex-direction: row;
139
- }
140
-
141
- .SidebarRuntimeSettings__item--icon {
142
- margin-right: 8px;
143
- display: flex;
144
- height: 16px;
145
- width: 16px;
146
- align-items: center;
147
- justify-content: center;
148
- }
149
-
150
- .SidebarSummary {
151
- width: 100%;
152
- display: flex;
153
- padding: var(--half-base-spacing) 0px;
154
- align-items: center;
155
- margin: var(--half-base-spacing) 0px;
156
- }
157
-
158
- .SidebarSummary__icon {
159
- display: flex;
160
- height: 16px;
161
- width: 16px;
162
- align-items: center;
163
- justify-content: center;
164
- /* Flex column-gap workaround for safari */
165
- margin: 0px 18px;
166
- }
167
-
168
- .SidebarSummary__label {
169
- font-size: var(--sidebar-summary-font-size);
170
- }
171
-
172
- .SidebarFlow {
173
- margin: var(--half-base-spacing) 0px;
174
- }
175
-
176
- .SidebarFlowStep {
177
- display: flex;
178
- padding-right: var(--base-spacing);
179
- }
180
-
181
- .SidebarFlowStep__label {
182
- grid-column: 2;
183
- margin: var(--half-base-spacing) 0px;
184
- justify-self: left;
185
- }
186
- .SidebarFlowStep__label--navigation {
187
- font-size: var(--sidebar-flow-step-navigation-font-size);
188
- }
189
-
190
- .SidebarFlowSeparator > .FlowSegment {
191
- height: var(--half-base-spacing);
192
- }
193
-
194
- .Summary {
195
- margin: 0 auto;
196
- min-width: var(--report-width);
197
- width: max-content;
198
- max-width: 90%;
199
- }
200
-
201
- .SummaryHeader {
202
- margin: var(--base-spacing) 0;
203
- }
204
-
205
- .SummaryHeader__title {
206
- margin: var(--base-spacing) 0;
207
- font-size: var(--summary-title-font-size);
208
- }
209
-
210
- .SummaryHeader__subtitle {
211
- font-size: var(--summary-subtitle-font-size);
212
- }
213
-
214
- .SummaryFlow {
215
- width: 100%;
216
- display: grid;
217
- grid-auto-rows: min-content;
218
- grid-template-columns: min-content min-content 4fr 1fr 1fr 1fr 1fr;
219
- align-items: center;
220
- }
221
-
222
- /* Hide top segment of sidebar flow */
223
- .SidebarFlow > :first-child .FlowSegment > .FlowSegment__top-line {
224
- background-color: transparent;
225
- }
226
-
227
- /* Hide end segments of summary flow */
228
- .SummaryFlow > :first-child > .FlowSegment > .FlowSegment__top-line {
229
- background-color: transparent;
230
- }
231
- .SummaryFlow > :last-child > .FlowSegment > .FlowSegment__bottom-line {
232
- background-color: transparent;
233
- }
234
-
235
- /* Hide segment for first navigation header */
236
- .SummaryFlow > :first-child .SummaryNavigationHeader .FlowSegment__bottom-line {
237
- background-color: transparent;
238
- }
239
- .SummaryFlow > :first-child .SummaryNavigationHeader .FlowSegment__top-line {
240
- background-color: transparent;
241
- }
242
-
243
- .SummaryFlowStep {
244
- display: contents;
245
- }
246
- .SummaryFlowStep .FlowSegment {
247
- grid-column: 2;
248
- }
249
-
250
- .SummaryFlowStep__screenshot {
251
- align-self: center;
252
- justify-self: center;
253
- margin: var(--base-spacing) var(--half-base-spacing);
254
- object-fit: cover;
255
- object-position: top left;
256
- }
257
- .SummaryFlowStep__screenshot[src] {
258
- border: 1px solid var(--color-gray);
259
- }
260
-
261
- .SummaryFlowStep__label {
262
- font-size: var(--summary-flow-step-label-font-size);
263
- color: var(--color-gray-800);
264
- text-decoration: underline;
265
- grid-column: 3;
266
- margin: var(--half-base-spacing);
267
- }
268
-
269
- .SummaryCategory {
270
- margin: var(--half-base-spacing);
271
- }
272
-
273
- .SummaryNavigationHeader {
274
- font-size: var(--summary-flow-step-label-font-size);
275
- display: contents;
276
- }
277
-
278
- .SummaryNavigationHeader__url,
279
- .SummaryNavigationHeader__category {
280
- height: 100%;
281
- display: flex;
282
- align-items: center;
283
- justify-content: center;
284
- padding: var(--half-base-spacing);
285
- background-color: var(--color-gray-200);
286
- text-align: center;
287
- }
288
- .SummaryNavigationHeader__url {
289
- justify-content: start;
290
- text-align: left;
291
- }
292
-
293
- .SummaryFlowStep__divider {
294
- display: contents;
295
- }
296
-
297
- .SummaryFlowStep__divider--line {
298
- grid-column-end: span 5;
299
- height: 1px;
300
- background-color: var(--color-gray-300);
301
- }
302
-
303
- .SummaryCategory__null {
304
- align-self: center;
305
- justify-self: center;
306
- height: 2px;
307
- width: 10px;
308
- margin: auto;
309
- background-color: var(--color-gray-700);
310
- }
@@ -1,24 +0,0 @@
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
- module.exports = {
8
- testEnvironment: 'node',
9
- preset: 'ts-jest',
10
- globalSetup: './test/setup/global-setup.ts',
11
- setupFilesAfterEnv: [
12
- './test/setup/env-setup.ts',
13
- ],
14
- testMatch: [
15
- '**/test/**/*-test.ts',
16
- '**/test/**/*-test.tsx',
17
- ],
18
- extensionsToTreatAsEsm: ['.ts', '.tsx'],
19
- globals: {
20
- 'ts-jest': {
21
- useESM: true,
22
- },
23
- },
24
- };