lighthouse 10.2.0 → 10.3.0-dev.20230613

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 (132) hide show
  1. package/cli/test/smokehouse/__snapshots__/report-assert-test.js.snap +4 -6
  2. package/core/audits/accessibility/html-xml-lang-mismatch.d.ts +10 -0
  3. package/core/audits/accessibility/html-xml-lang-mismatch.js +47 -0
  4. package/core/audits/accessibility/input-button-name.d.ts +10 -0
  5. package/core/audits/accessibility/input-button-name.js +44 -0
  6. package/core/audits/accessibility/table-fake-caption.d.ts +10 -0
  7. package/core/audits/accessibility/table-fake-caption.js +47 -0
  8. package/core/audits/accessibility/td-has-header.d.ts +10 -0
  9. package/core/audits/accessibility/td-has-header.js +45 -0
  10. package/core/audits/audit.d.ts +2 -1
  11. package/core/audits/audit.js +5 -2
  12. package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +3 -3
  13. package/core/audits/byte-efficiency/byte-efficiency-audit.js +14 -19
  14. package/core/audits/deprecations.js +1 -1
  15. package/core/audits/largest-contentful-paint-element.d.ts +14 -2
  16. package/core/audits/largest-contentful-paint-element.js +49 -31
  17. package/core/audits/layout-shift-elements.d.ts +3 -2
  18. package/core/audits/layout-shift-elements.js +10 -2
  19. package/core/audits/metrics.js +0 -2
  20. package/core/audits/network-requests.js +6 -0
  21. package/core/audits/seo/crawlable-anchors.js +4 -0
  22. package/core/audits/server-response-time.d.ts +2 -1
  23. package/core/audits/server-response-time.js +17 -3
  24. package/core/audits/uses-rel-preconnect.js +20 -4
  25. package/core/computed/entity-classification.d.ts +14 -1
  26. package/core/computed/entity-classification.js +61 -6
  27. package/core/computed/metrics/cumulative-layout-shift.d.ts +2 -9
  28. package/core/computed/metrics/cumulative-layout-shift.js +3 -16
  29. package/core/computed/metrics/time-to-first-byte.js +10 -7
  30. package/core/computed/metrics/timing-summary.js +0 -3
  31. package/core/config/default-config.js +8 -0
  32. package/core/gather/driver/execution-context.js +13 -5
  33. package/core/gather/driver/target-manager.d.ts +13 -0
  34. package/core/gather/driver/target-manager.js +49 -0
  35. package/core/gather/gatherers/accessibility.js +19 -20
  36. package/core/gather/gatherers/anchor-elements.js +2 -0
  37. package/core/gather/gatherers/global-listeners.js +38 -21
  38. package/core/gather/gatherers/inspector-issues.js +2 -1
  39. package/core/gather/gatherers/trace-elements.d.ts +3 -2
  40. package/core/gather/gatherers/trace-elements.js +10 -19
  41. package/core/legacy/config/config.d.ts +1 -1
  42. package/core/legacy/config/config.js +1 -1
  43. package/core/legacy/gather/driver.d.ts +1 -0
  44. package/core/legacy/gather/driver.js +11 -0
  45. package/core/lib/asset-saver.d.ts +4 -0
  46. package/core/lib/asset-saver.js +19 -0
  47. package/core/lib/bf-cache-strings.d.ts +3 -0
  48. package/core/lib/bf-cache-strings.js +248 -232
  49. package/core/lib/cdt/generated/SourceMap.d.ts +18 -31
  50. package/core/lib/cdt/generated/SourceMap.js +51 -101
  51. package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +6 -2
  52. package/core/lib/dependency-graph/simulator/network-analyzer.js +45 -13
  53. package/core/lib/deprecation-description.d.ts +17 -0
  54. package/core/lib/deprecation-description.js +71 -0
  55. package/core/lib/deprecations-strings.d.ts +282 -63
  56. package/core/lib/deprecations-strings.js +282 -551
  57. package/core/lib/lh-error.d.ts +9 -4
  58. package/core/lib/lh-error.js +15 -11
  59. package/core/lib/network-request.d.ts +13 -6
  60. package/core/lib/network-request.js +39 -14
  61. package/core/lib/tracehouse/trace-processor.js +1 -1
  62. package/core/lib/url-utils.js +4 -0
  63. package/core/runner.js +4 -2
  64. package/dist/report/bundle.esm.js +24 -7
  65. package/dist/report/flow.js +3 -3
  66. package/dist/report/standalone.js +8 -8
  67. package/package.json +12 -12
  68. package/readme.md +7 -0
  69. package/report/assets/styles.css +18 -2
  70. package/report/assets/templates.html +4 -0
  71. package/report/renderer/category-renderer.js +5 -2
  72. package/report/renderer/components.js +2 -2
  73. package/report/renderer/dom.d.ts +4 -1
  74. package/report/renderer/dom.js +3 -2
  75. package/shared/localization/locales/ar-XB.json +20 -170
  76. package/shared/localization/locales/ar.json +20 -170
  77. package/shared/localization/locales/bg.json +19 -169
  78. package/shared/localization/locales/ca.json +19 -169
  79. package/shared/localization/locales/cs.json +19 -169
  80. package/shared/localization/locales/da.json +19 -169
  81. package/shared/localization/locales/de.json +19 -169
  82. package/shared/localization/locales/el.json +19 -169
  83. package/shared/localization/locales/en-GB.json +9 -159
  84. package/shared/localization/locales/en-US.json +151 -70
  85. package/shared/localization/locales/en-XA.json +20 -170
  86. package/shared/localization/locales/en-XL.json +151 -70
  87. package/shared/localization/locales/es-419.json +19 -169
  88. package/shared/localization/locales/es.json +19 -169
  89. package/shared/localization/locales/fi.json +19 -169
  90. package/shared/localization/locales/fil.json +17 -167
  91. package/shared/localization/locales/fr.json +18 -168
  92. package/shared/localization/locales/he.json +19 -169
  93. package/shared/localization/locales/hi.json +20 -170
  94. package/shared/localization/locales/hr.json +19 -169
  95. package/shared/localization/locales/hu.json +19 -169
  96. package/shared/localization/locales/id.json +19 -169
  97. package/shared/localization/locales/it.json +19 -169
  98. package/shared/localization/locales/ja.json +19 -169
  99. package/shared/localization/locales/ko.json +19 -169
  100. package/shared/localization/locales/lt.json +20 -170
  101. package/shared/localization/locales/lv.json +20 -170
  102. package/shared/localization/locales/nl.json +18 -168
  103. package/shared/localization/locales/no.json +19 -169
  104. package/shared/localization/locales/pl.json +19 -169
  105. package/shared/localization/locales/pt-PT.json +19 -169
  106. package/shared/localization/locales/pt.json +19 -169
  107. package/shared/localization/locales/ro.json +19 -169
  108. package/shared/localization/locales/ru.json +19 -169
  109. package/shared/localization/locales/sk.json +20 -170
  110. package/shared/localization/locales/sl.json +19 -169
  111. package/shared/localization/locales/sr-Latn.json +19 -169
  112. package/shared/localization/locales/sr.json +19 -169
  113. package/shared/localization/locales/sv.json +19 -169
  114. package/shared/localization/locales/ta.json +19 -169
  115. package/shared/localization/locales/te.json +19 -169
  116. package/shared/localization/locales/th.json +19 -169
  117. package/shared/localization/locales/tr.json +19 -169
  118. package/shared/localization/locales/uk.json +19 -169
  119. package/shared/localization/locales/vi.json +20 -170
  120. package/shared/localization/locales/zh-HK.json +19 -169
  121. package/shared/localization/locales/zh-TW.json +19 -169
  122. package/shared/localization/locales/zh.json +19 -169
  123. package/shared/util.d.ts +6 -0
  124. package/shared/util.js +14 -1
  125. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +2 -1
  126. package/tsconfig-base.json +1 -1
  127. package/types/artifacts.d.ts +10 -8
  128. package/types/audit.d.ts +5 -0
  129. package/types/gatherer.d.ts +1 -0
  130. package/types/lhr/audit-details.d.ts +1 -0
  131. package/types/lhr/audit-result.d.ts +10 -0
  132. package/types/internal/es-main.d.ts +0 -18
@@ -410,6 +410,7 @@ declare module Artifacts {
410
410
  target: string
411
411
  node: NodeDetails
412
412
  onclick: string
413
+ id: string
413
414
  listeners?: Array<{
414
415
  type: Crdp.DOMDebugger.EventListener['type']
415
416
  }>
@@ -617,7 +618,8 @@ declare module Artifacts {
617
618
  quirksModeIssue: Crdp.Audits.QuirksModeIssueDetails[];
618
619
  cookieIssue: Crdp.Audits.CookieIssueDetails[];
619
620
  sharedArrayBufferIssue: Crdp.Audits.SharedArrayBufferIssueDetails[];
620
- twaQualityEnforcement: Crdp.Audits.TrustedWebActivityIssueDetails[];
621
+ stylesheetLoadingIssue: Crdp.Audits.StylesheetLoadingIssueDetails[];
622
+ federatedAuthUserInfoRequestIssue: Crdp.Audits.FederatedAuthUserInfoRequestIssueDetails[];
621
623
  }
622
624
 
623
625
  // Computed artifact types below.
@@ -800,7 +802,6 @@ declare module Artifacts {
800
802
  maxPotentialFID: number | undefined;
801
803
  cumulativeLayoutShift: number | undefined;
802
804
  cumulativeLayoutShiftMainFrame: number | undefined;
803
- totalCumulativeLayoutShift: number | undefined;
804
805
  totalBlockingTime: number | undefined;
805
806
  observedTimeOrigin: number;
806
807
  observedTimeOriginTs: number;
@@ -808,7 +809,6 @@ declare module Artifacts {
808
809
  observedNavigationStartTs: number | undefined;
809
810
  observedCumulativeLayoutShift: number | undefined;
810
811
  observedCumulativeLayoutShiftMainFrame: number | undefined;
811
- observedTotalCumulativeLayoutShift: number | undefined;
812
812
  observedFirstPaint: number | undefined;
813
813
  observedFirstPaintTs: number | undefined;
814
814
  observedFirstContentfulPaint: number | undefined;
@@ -949,6 +949,12 @@ declare module Artifacts {
949
949
  // Convenience methods.
950
950
  isFirstParty: (url: string) => boolean;
951
951
  }
952
+
953
+ interface TraceImpactedNode {
954
+ node_id: number;
955
+ old_rect?: Array<number>;
956
+ new_rect?: Array<number>;
957
+ }
952
958
  }
953
959
 
954
960
  export interface Trace {
@@ -1018,11 +1024,7 @@ export interface TraceEvent {
1018
1024
  nodeId?: number;
1019
1025
  DOMNodeId?: number;
1020
1026
  imageUrl?: string;
1021
- impacted_nodes?: Array<{
1022
- node_id: number,
1023
- old_rect?: Array<number>,
1024
- new_rect?: Array<number>,
1025
- }>;
1027
+ impacted_nodes?: Artifacts.TraceImpactedNode[];
1026
1028
  score?: number;
1027
1029
  weighted_score_delta?: number;
1028
1030
  had_recent_input?: boolean;
package/types/audit.d.ts CHANGED
@@ -18,6 +18,7 @@ declare module Audit {
18
18
  export type Result = AuditResult.Result;
19
19
  export type ScoreDisplayMode = AuditResult.ScoreDisplayMode;
20
20
  export type ScoreDisplayModes = AuditResult.ScoreDisplayModes;
21
+ export type MetricSavings = AuditResult.MetricSavings;
21
22
 
22
23
  type Context = Util.Immutable<{
23
24
  /** audit options */
@@ -74,6 +75,8 @@ declare module Audit {
74
75
  explanation?: string | IcuMessage;
75
76
  /** Error message from any exception thrown while running this audit. */
76
77
  errorMessage?: string | IcuMessage;
78
+ /** Error stack from any exception thrown while running this audit. */
79
+ errorStack?: string;
77
80
  warnings?: Array<string | IcuMessage>;
78
81
  /** Overrides scoreDisplayMode with notApplicable if set to true */
79
82
  notApplicable?: boolean;
@@ -81,6 +84,8 @@ declare module Audit {
81
84
  details?: AuditDetails;
82
85
  /** If an audit encounters unusual execution circumstances, strings can be put in this optional array to add top-level warnings to the LHR. */
83
86
  runWarnings?: Array<IcuMessage>;
87
+ /** [EXPERIMENTAL] Estimates of how much this audit affects various performance metrics. Values will be in the unit of the respective metrics. */
88
+ metricSavings?: MetricSavings;
84
89
  }
85
90
 
86
91
  /** The Audit.Product type for audits that do not return a `numericValue`. */
@@ -47,6 +47,7 @@ declare module Gatherer {
47
47
  url: () => Promise<string>;
48
48
  targetManager: {
49
49
  rootSession(): FRProtocolSession;
50
+ mainFrameExecutionContexts(): Array<Crdp.Runtime.ExecutionContextDescription>;
50
51
  on(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
51
52
  off(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
52
53
  };
@@ -303,6 +303,7 @@ declare module Details {
303
303
  value: number,
304
304
  granularity?: number,
305
305
  }
306
+
306
307
  }
307
308
 
308
309
  export default Details;
@@ -24,6 +24,14 @@ interface ScoreDisplayModes {
24
24
 
25
25
  type ScoreDisplayMode = ScoreDisplayModes[keyof ScoreDisplayModes];
26
26
 
27
+ interface MetricSavings {
28
+ LCP?: number;
29
+ FCP?: number;
30
+ CLS?: number;
31
+ TBT?: number;
32
+ INP?: number;
33
+ }
34
+
27
35
  /** Audit result returned in Lighthouse report. All audits offer a description and score of 0-1. */
28
36
  export interface Result {
29
37
  displayValue?: string;
@@ -31,6 +39,8 @@ export interface Result {
31
39
  explanation?: string;
32
40
  /** Error message from any exception thrown while running this audit. */
33
41
  errorMessage?: string;
42
+ /** Error stack from any exception thrown while running this audit. */
43
+ errorStack?: string;
34
44
  warnings?: string[];
35
45
  /** The scored value of the audit, provided in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */
36
46
  score: number|null;
@@ -1,18 +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
- /**
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
- }