lighthouse 12.0.0 → 12.1.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 (219) hide show
  1. package/cli/run.js +5 -38
  2. package/cli/test/smokehouse/lighthouse-runners/bundle.js +1 -1
  3. package/cli/test/smokehouse/smokehouse.js +11 -1
  4. package/core/audits/accessibility/aria-allowed-role.js +7 -9
  5. package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +2 -2
  6. package/core/audits/byte-efficiency/byte-efficiency-audit.js +3 -3
  7. package/core/audits/byte-efficiency/offscreen-images.js +1 -1
  8. package/core/audits/byte-efficiency/render-blocking-resources.d.ts +3 -3
  9. package/core/audits/byte-efficiency/render-blocking-resources.js +10 -10
  10. package/core/audits/dobetterweb/uses-http2.d.ts +2 -2
  11. package/core/audits/dobetterweb/uses-http2.js +5 -5
  12. package/core/audits/long-tasks.d.ts +7 -6
  13. package/core/audits/long-tasks.js +5 -4
  14. package/core/audits/metrics/first-meaningful-paint.d.ts +1 -17
  15. package/core/audits/metrics/first-meaningful-paint.js +5 -47
  16. package/core/audits/metrics/interactive.d.ts +1 -1
  17. package/core/audits/metrics/interactive.js +1 -1
  18. package/core/audits/predictive-perf.js +0 -6
  19. package/core/audits/prioritize-lcp-image.d.ts +1 -1
  20. package/core/audits/prioritize-lcp-image.js +2 -2
  21. package/core/audits/redirects.js +2 -3
  22. package/core/audits/third-party-facades.js +1 -1
  23. package/core/audits/third-party-summary.js +1 -1
  24. package/core/audits/uses-rel-preconnect.js +2 -2
  25. package/core/audits/uses-rel-preload.js +9 -9
  26. package/core/computed/critical-request-chains.js +3 -3
  27. package/core/computed/document-urls.js +3 -2
  28. package/core/computed/load-simulator.d.ts +4 -4
  29. package/core/computed/load-simulator.js +3 -54
  30. package/core/computed/main-resource.js +3 -2
  31. package/core/computed/metrics/interactive.d.ts +6 -0
  32. package/core/computed/metrics/interactive.js +2 -2
  33. package/core/computed/metrics/lantern-first-contentful-paint.d.ts +4 -4
  34. package/core/computed/metrics/lantern-first-contentful-paint.js +3 -3
  35. package/core/computed/metrics/lantern-interactive.d.ts +4 -4
  36. package/core/computed/metrics/lantern-interactive.js +6 -6
  37. package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +4 -4
  38. package/core/computed/metrics/lantern-largest-contentful-paint.js +3 -3
  39. package/core/computed/metrics/lantern-max-potential-fid.d.ts +4 -4
  40. package/core/computed/metrics/lantern-max-potential-fid.js +3 -3
  41. package/core/computed/metrics/lantern-metric.d.ts +21 -2
  42. package/core/computed/metrics/lantern-metric.js +39 -4
  43. package/core/computed/metrics/lantern-speed-index.d.ts +4 -4
  44. package/core/computed/metrics/lantern-speed-index.js +4 -4
  45. package/core/computed/metrics/lantern-total-blocking-time.d.ts +4 -4
  46. package/core/computed/metrics/lantern-total-blocking-time.js +3 -3
  47. package/core/computed/metrics/timing-summary.js +0 -6
  48. package/core/computed/metrics/total-blocking-time.js +3 -1
  49. package/core/computed/navigation-insights.d.ts +2 -20
  50. package/core/computed/network-analysis.d.ts +0 -5
  51. package/core/computed/network-analysis.js +2 -42
  52. package/core/computed/page-dependency-graph.d.ts +5 -3
  53. package/core/computed/page-dependency-graph.js +17 -7
  54. package/core/computed/processed-navigation.d.ts +1 -1
  55. package/core/computed/tbt-impact-tasks.js +4 -2
  56. package/core/computed/trace-engine-result.d.ts +0 -11
  57. package/core/computed/trace-engine-result.js +5 -19
  58. package/core/config/constants.d.ts +28 -53
  59. package/core/config/constants.js +2 -43
  60. package/core/gather/driver/navigation.js +1 -1
  61. package/core/gather/driver/network-monitor.d.ts +2 -1
  62. package/core/gather/driver/network-monitor.js +4 -4
  63. package/core/gather/driver/target-manager.d.ts +1 -1
  64. package/core/gather/driver.d.ts +0 -12
  65. package/core/gather/driver.js +1 -26
  66. package/core/gather/gatherers/inspector-issues.js +1 -0
  67. package/core/gather/gatherers/root-causes.js +0 -1
  68. package/core/gather/session.d.ts +5 -3
  69. package/core/gather/session.js +22 -1
  70. package/core/lib/asset-saver.d.ts +13 -9
  71. package/core/lib/asset-saver.js +77 -30
  72. package/core/lib/bf-cache-strings.js +2 -2
  73. package/core/lib/lantern/{base-node.d.ts → BaseNode.d.ts} +7 -9
  74. package/core/lib/lantern/{base-node.js → BaseNode.js} +6 -6
  75. package/core/lib/lantern/BaseNode.test.js +385 -0
  76. package/core/lib/lantern/CpuNode.d.ts +43 -0
  77. package/core/lib/lantern/{cpu-node.js → CpuNode.js} +8 -9
  78. package/core/lib/lantern/{lantern-error.d.ts → LanternError.d.ts} +1 -1
  79. package/core/lib/lantern/{metric.d.ts → Metric.d.ts} +23 -25
  80. package/core/lib/lantern/{metric.js → Metric.js} +14 -16
  81. package/core/lib/lantern/{network-node.d.ts → NetworkNode.d.ts} +6 -7
  82. package/core/lib/lantern/{network-node.js → NetworkNode.js} +7 -9
  83. package/core/lib/lantern/PageDependencyGraph.d.ts +82 -0
  84. package/core/lib/lantern/{page-dependency-graph.js → PageDependencyGraph.js} +185 -50
  85. package/core/lib/lantern/PageDependencyGraph.test.js +654 -0
  86. package/core/{computed/metrics/tbt-utils.d.ts → lib/lantern/TBTUtils.d.ts} +1 -1
  87. package/core/lib/lantern/TBTUtils.test.d.ts +2 -0
  88. package/core/lib/lantern/TBTUtils.test.js +130 -0
  89. package/core/lib/lantern/TraceEngineComputationData.d.ts +25 -0
  90. package/core/lib/lantern/TraceEngineComputationData.js +466 -0
  91. package/core/lib/lantern/lantern.d.ts +19 -7
  92. package/core/lib/lantern/lantern.js +21 -1
  93. package/core/lib/lantern/metrics/{first-contentful-paint.d.ts → FirstContentfulPaint.d.ts} +11 -11
  94. package/core/lib/lantern/metrics/{first-contentful-paint.js → FirstContentfulPaint.js} +11 -13
  95. package/core/lib/lantern/metrics/FirstContentfulPaint.test.js +54 -0
  96. package/core/lib/lantern/metrics/Interactive.d.ts +20 -0
  97. package/core/lib/lantern/metrics/{interactive.js → Interactive.js} +23 -26
  98. package/core/lib/lantern/metrics/Interactive.test.js +56 -0
  99. package/core/lib/lantern/metrics/LargestContentfulPaint.d.ts +19 -0
  100. package/core/lib/lantern/metrics/{largest-contentful-paint.js → LargestContentfulPaint.js} +16 -19
  101. package/core/lib/lantern/metrics/LargestContentfulPaint.test.js +42 -0
  102. package/core/lib/lantern/metrics/MaxPotentialFID.d.ts +24 -0
  103. package/core/lib/lantern/metrics/{max-potential-fid.js → MaxPotentialFID.js} +12 -13
  104. package/core/lib/lantern/metrics/MetricTestUtils.d.ts +19 -0
  105. package/core/lib/lantern/metrics/MetricTestUtils.js +48 -0
  106. package/core/lib/lantern/metrics/{speed-index.d.ts → SpeedIndex.d.ts} +7 -13
  107. package/core/lib/lantern/metrics/{speed-index.js → SpeedIndex.js} +14 -16
  108. package/core/lib/lantern/metrics/SpeedIndex.test.js +83 -0
  109. package/core/lib/lantern/metrics/TotalBlockingTime.d.ts +25 -0
  110. package/core/lib/lantern/metrics/{total-blocking-time.js → TotalBlockingTime.js} +13 -16
  111. package/core/lib/lantern/metrics/__snapshots__/FirstContentfulPaint.test.js.snap +11 -0
  112. package/core/lib/lantern/metrics/__snapshots__/Interactive.test.js.snap +17 -0
  113. package/core/lib/lantern/metrics/metrics.d.ts +9 -0
  114. package/core/lib/lantern/metrics/metrics.js +16 -0
  115. package/core/lib/lantern/{simulator/connection-pool.d.ts → simulation/ConnectionPool.d.ts} +15 -15
  116. package/core/lib/lantern/{simulator/connection-pool.js → simulation/ConnectionPool.js} +25 -25
  117. package/core/lib/lantern/simulation/ConnectionPool.test.js +195 -0
  118. package/core/lib/lantern/simulation/Constants.d.ts +52 -0
  119. package/core/lib/lantern/simulation/Constants.js +48 -0
  120. package/core/lib/lantern/{simulator/dns-cache.d.ts → simulation/DNSCache.d.ts} +3 -3
  121. package/core/lib/lantern/{simulator/dns-cache.js → simulation/DNSCache.js} +2 -2
  122. package/core/lib/lantern/simulation/DNSCache.test.js +72 -0
  123. package/core/lib/lantern/{simulator/network-analyzer.d.ts → simulation/NetworkAnalyzer.d.ts} +34 -21
  124. package/core/lib/lantern/{simulator/network-analyzer.js → simulation/NetworkAnalyzer.js} +106 -57
  125. package/core/lib/lantern/simulation/NetworkAnalyzer.test.js +475 -0
  126. package/core/lib/lantern/{simulator/simulator-timing-map.d.ts → simulation/SimulationTimingMap.d.ts} +7 -7
  127. package/core/lib/lantern/{simulator/simulator-timing-map.js → simulation/SimulationTimingMap.js} +5 -6
  128. package/core/lib/lantern/{simulator/simulator.d.ts → simulation/Simulator.d.ts} +21 -19
  129. package/core/lib/lantern/{simulator/simulator.js → simulation/Simulator.js} +100 -45
  130. package/core/lib/lantern/simulation/Simulator.test.js +434 -0
  131. package/core/lib/lantern/simulation/TCPConnection.test.d.ts +2 -0
  132. package/core/lib/lantern/simulation/TCPConnection.test.js +374 -0
  133. package/core/lib/lantern/{simulator/tcp-connection.d.ts → simulation/TcpConnection.d.ts} +2 -2
  134. package/core/lib/lantern/{simulator/tcp-connection.js → simulation/TcpConnection.js} +1 -1
  135. package/core/lib/lantern/simulation/simulation.d.ts +21 -0
  136. package/core/lib/lantern/simulation/simulation.js +28 -0
  137. package/core/lib/lantern/types/lantern.d.ts +145 -20
  138. package/core/lib/lantern-trace-saver.d.ts +4 -4
  139. package/core/lib/lantern-trace-saver.js +4 -4
  140. package/core/lib/navigation-error.js +3 -3
  141. package/core/lib/network-recorder.js +2 -2
  142. package/core/lib/network-request.d.ts +29 -3
  143. package/core/lib/network-request.js +20 -13
  144. package/core/lib/tracehouse/trace-processor.d.ts +0 -2
  145. package/core/lib/tracehouse/trace-processor.js +1 -31
  146. package/core/lib/traces/metric-trace-events.js +0 -5
  147. package/dist/report/bundle.esm.js +1 -1
  148. package/dist/report/flow.js +1 -1
  149. package/dist/report/standalone.js +1 -1
  150. package/package.json +14 -13
  151. package/report/renderer/performance-category-renderer.js +1 -1
  152. package/shared/localization/locales/ar-XB.json +43 -4
  153. package/shared/localization/locales/ar.json +43 -4
  154. package/shared/localization/locales/bg.json +43 -4
  155. package/shared/localization/locales/ca.json +44 -5
  156. package/shared/localization/locales/cs.json +43 -4
  157. package/shared/localization/locales/da.json +43 -4
  158. package/shared/localization/locales/de.json +43 -4
  159. package/shared/localization/locales/el.json +43 -4
  160. package/shared/localization/locales/en-GB.json +42 -3
  161. package/shared/localization/locales/en-US.json +4 -4
  162. package/shared/localization/locales/en-XA.json +43 -4
  163. package/shared/localization/locales/en-XL.json +4 -4
  164. package/shared/localization/locales/es-419.json +43 -4
  165. package/shared/localization/locales/es.json +42 -3
  166. package/shared/localization/locales/fi.json +43 -4
  167. package/shared/localization/locales/fil.json +42 -3
  168. package/shared/localization/locales/fr.json +42 -3
  169. package/shared/localization/locales/he.json +48 -9
  170. package/shared/localization/locales/hi.json +43 -4
  171. package/shared/localization/locales/hr.json +43 -4
  172. package/shared/localization/locales/hu.json +42 -3
  173. package/shared/localization/locales/id.json +42 -3
  174. package/shared/localization/locales/it.json +43 -4
  175. package/shared/localization/locales/ja.json +42 -3
  176. package/shared/localization/locales/ko.json +43 -4
  177. package/shared/localization/locales/lt.json +42 -3
  178. package/shared/localization/locales/lv.json +43 -4
  179. package/shared/localization/locales/nl.json +44 -5
  180. package/shared/localization/locales/no.json +42 -3
  181. package/shared/localization/locales/pl.json +43 -4
  182. package/shared/localization/locales/pt-PT.json +43 -4
  183. package/shared/localization/locales/pt.json +43 -4
  184. package/shared/localization/locales/ro.json +43 -4
  185. package/shared/localization/locales/ru.json +43 -4
  186. package/shared/localization/locales/sk.json +43 -4
  187. package/shared/localization/locales/sl.json +42 -3
  188. package/shared/localization/locales/sr-Latn.json +43 -4
  189. package/shared/localization/locales/sr.json +43 -4
  190. package/shared/localization/locales/sv.json +42 -3
  191. package/shared/localization/locales/ta.json +42 -3
  192. package/shared/localization/locales/te.json +43 -4
  193. package/shared/localization/locales/th.json +44 -5
  194. package/shared/localization/locales/tr.json +43 -4
  195. package/shared/localization/locales/uk.json +43 -4
  196. package/shared/localization/locales/vi.json +43 -4
  197. package/shared/localization/locales/zh-HK.json +43 -4
  198. package/shared/localization/locales/zh-TW.json +43 -4
  199. package/shared/localization/locales/zh.json +43 -4
  200. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +1 -0
  201. package/tsconfig-all.json +1 -0
  202. package/tsconfig.json +11 -7
  203. package/types/artifacts.d.ts +23 -25
  204. package/types/gatherer.d.ts +2 -3
  205. package/types/lhr/lhr.d.ts +2 -0
  206. package/core/computed/metrics/first-meaningful-paint.d.ts +0 -21
  207. package/core/computed/metrics/first-meaningful-paint.js +0 -44
  208. package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +0 -25
  209. package/core/computed/metrics/lantern-first-meaningful-paint.js +0 -43
  210. package/core/lib/lantern/cpu-node.d.ts +0 -44
  211. package/core/lib/lantern/metrics/first-meaningful-paint.d.ts +0 -6
  212. package/core/lib/lantern/metrics/first-meaningful-paint.js +0 -64
  213. package/core/lib/lantern/metrics/interactive.d.ts +0 -26
  214. package/core/lib/lantern/metrics/largest-contentful-paint.d.ts +0 -19
  215. package/core/lib/lantern/metrics/max-potential-fid.d.ts +0 -30
  216. package/core/lib/lantern/metrics/total-blocking-time.d.ts +0 -31
  217. package/core/lib/lantern/page-dependency-graph.d.ts +0 -58
  218. /package/core/lib/lantern/{lantern-error.js → LanternError.js} +0 -0
  219. /package/core/{computed/metrics/tbt-utils.js → lib/lantern/TBTUtils.js} +0 -0
@@ -1,44 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- import {makeComputedArtifact} from '../computed-artifact.js';
8
- import {NavigationMetric} from './navigation-metric.js';
9
- import {LighthouseError} from '../../lib/lh-error.js';
10
- import {LanternFirstMeaningfulPaint} from './lantern-first-meaningful-paint.js';
11
-
12
- class FirstMeaningfulPaint extends NavigationMetric {
13
- /**
14
- * @param {LH.Artifacts.NavigationMetricComputationData} data
15
- * @param {LH.Artifacts.ComputedContext} context
16
- * @return {Promise<LH.Artifacts.LanternMetric>}
17
- */
18
- static computeSimulatedMetric(data, context) {
19
- const metricData = NavigationMetric.getMetricComputationInput(data);
20
- return LanternFirstMeaningfulPaint.request(metricData, context);
21
- }
22
-
23
- /**
24
- * @param {LH.Artifacts.NavigationMetricComputationData} data
25
- * @return {Promise<LH.Artifacts.Metric>}
26
- */
27
- static async computeObservedMetric(data) {
28
- const {processedNavigation} = data;
29
- if (processedNavigation.timings.firstMeaningfulPaint === undefined) {
30
- throw new LighthouseError(LighthouseError.errors.NO_FMP);
31
- }
32
-
33
- return {
34
- timing: processedNavigation.timings.firstMeaningfulPaint,
35
- timestamp: processedNavigation.timestamps.firstMeaningfulPaint,
36
- };
37
- }
38
- }
39
-
40
- const FirstMeaningfulPaintComputed = makeComputedArtifact(
41
- FirstMeaningfulPaint,
42
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
43
- );
44
- export {FirstMeaningfulPaintComputed as FirstMeaningfulPaint};
@@ -1,25 +0,0 @@
1
- export { LanternFirstMeaningfulPaintComputed as LanternFirstMeaningfulPaint };
2
- export type Extras = import('../../lib/lantern/metric.js').Extras;
3
- declare const LanternFirstMeaningfulPaintComputed: typeof LanternFirstMeaningfulPaint & {
4
- request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
5
- computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
6
- }>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
7
- };
8
- /** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
9
- declare class LanternFirstMeaningfulPaint extends FirstMeaningfulPaint {
10
- /**
11
- * @param {LH.Artifacts.MetricComputationDataInput} data
12
- * @param {LH.Artifacts.ComputedContext} context
13
- * @param {Omit<Extras, 'optimistic'>=} extras
14
- * @return {Promise<LH.Artifacts.LanternMetric>}
15
- */
16
- static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
17
- /**
18
- * @param {LH.Artifacts.MetricComputationDataInput} data
19
- * @param {LH.Artifacts.ComputedContext} context
20
- * @return {Promise<LH.Artifacts.LanternMetric>}
21
- */
22
- static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
23
- }
24
- import { FirstMeaningfulPaint } from '../../lib/lantern/metrics/first-meaningful-paint.js';
25
- //# sourceMappingURL=lantern-first-meaningful-paint.d.ts.map
@@ -1,43 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- import {makeComputedArtifact} from '../computed-artifact.js';
8
- import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
9
- import {FirstMeaningfulPaint} from '../../lib/lantern/metrics/first-meaningful-paint.js';
10
- import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
11
-
12
- /** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
13
-
14
- class LanternFirstMeaningfulPaint extends FirstMeaningfulPaint {
15
- /**
16
- * @param {LH.Artifacts.MetricComputationDataInput} data
17
- * @param {LH.Artifacts.ComputedContext} context
18
- * @param {Omit<Extras, 'optimistic'>=} extras
19
- * @return {Promise<LH.Artifacts.LanternMetric>}
20
- */
21
- static async computeMetricWithGraphs(data, context, extras) {
22
- return this.compute(await getComputationDataParams(data, context), extras)
23
- .catch(lanternErrorAdapter);
24
- }
25
-
26
- /**
27
- * @param {LH.Artifacts.MetricComputationDataInput} data
28
- * @param {LH.Artifacts.ComputedContext} context
29
- * @return {Promise<LH.Artifacts.LanternMetric>}
30
- */
31
- static async compute_(data, context) {
32
- const fcpResult = await LanternFirstContentfulPaint.request(data, context);
33
- const metricResult = await this.computeMetricWithGraphs(data, context);
34
- metricResult.timing = Math.max(metricResult.timing, fcpResult.timing);
35
- return metricResult;
36
- }
37
- }
38
-
39
- const LanternFirstMeaningfulPaintComputed = makeComputedArtifact(
40
- LanternFirstMeaningfulPaint,
41
- ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
42
- );
43
- export {LanternFirstMeaningfulPaintComputed as LanternFirstMeaningfulPaint};
@@ -1,44 +0,0 @@
1
- /**
2
- * @template [T=any]
3
- * @extends {BaseNode<T>}
4
- */
5
- export class CPUNode<T = any> extends BaseNode<T> {
6
- /**
7
- * @param {LH.TraceEvent} parentEvent
8
- * @param {LH.TraceEvent[]=} childEvents
9
- * @param {number=} correctedEndTs
10
- */
11
- constructor(parentEvent: LH.TraceEvent, childEvents?: LH.TraceEvent[] | undefined, correctedEndTs?: number | undefined);
12
- _event: LH.TraceEvent;
13
- _childEvents: LH.TraceEvent[];
14
- _correctedEndTs: number | undefined;
15
- get type(): "cpu";
16
- /**
17
- * @return {number}
18
- */
19
- get duration(): number;
20
- /**
21
- * @return {LH.TraceEvent}
22
- */
23
- get event(): LH.TraceEvent;
24
- /**
25
- * @return {LH.TraceEvent[]}
26
- */
27
- get childEvents(): LH.TraceEvent[];
28
- /**
29
- * Returns true if this node contains a Layout task.
30
- * @return {boolean}
31
- */
32
- didPerformLayout(): boolean;
33
- /**
34
- * Returns the script URLs that had their EvaluateScript events occur in this task.
35
- */
36
- getEvaluateScriptURLs(): Set<string>;
37
- /**
38
- * @return {CPUNode}
39
- */
40
- cloneWithoutRelationships(): CPUNode;
41
- }
42
- import { BaseNode } from './base-node.js';
43
- import * as LH from '../../../types/lh.js';
44
- //# sourceMappingURL=cpu-node.d.ts.map
@@ -1,6 +0,0 @@
1
- export type Node = import('../base-node.js').Node;
2
- /** @typedef {import('../base-node.js').Node} Node */
3
- export class FirstMeaningfulPaint extends Metric {
4
- }
5
- import { Metric } from '../metric.js';
6
- //# sourceMappingURL=first-meaningful-paint.d.ts.map
@@ -1,64 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2024 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- import * as Lantern from '../types/lantern.js';
8
- import {Metric} from '../metric.js';
9
- import {FirstContentfulPaint} from './first-contentful-paint.js';
10
-
11
- /** @typedef {import('../base-node.js').Node} Node */
12
-
13
- class FirstMeaningfulPaint extends Metric {
14
- /**
15
- * @return {Lantern.Simulation.MetricCoefficients}
16
- */
17
- static get COEFFICIENTS() {
18
- return {
19
- intercept: 0,
20
- optimistic: 0.5,
21
- pessimistic: 0.5,
22
- };
23
- }
24
-
25
- /**
26
- * @param {Node} dependencyGraph
27
- * @param {LH.Artifacts.ProcessedNavigation} processedNavigation
28
- * @return {Node}
29
- */
30
- static getOptimisticGraph(dependencyGraph, processedNavigation) {
31
- const fmp = processedNavigation.timestamps.firstMeaningfulPaint;
32
- if (!fmp) {
33
- throw new Error('NO_FMP');
34
- }
35
- return FirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {
36
- cutoffTimestamp: fmp,
37
- // See FirstContentfulPaint's getOptimisticGraph implementation for a longer description
38
- // of why we exclude script initiated resources here.
39
- treatNodeAsRenderBlocking: node =>
40
- node.hasRenderBlockingPriority() && node.initiatorType !== 'script',
41
- });
42
- }
43
-
44
- /**
45
- * @param {Node} dependencyGraph
46
- * @param {LH.Artifacts.ProcessedNavigation} processedNavigation
47
- * @return {Node}
48
- */
49
- static getPessimisticGraph(dependencyGraph, processedNavigation) {
50
- const fmp = processedNavigation.timestamps.firstMeaningfulPaint;
51
- if (!fmp) {
52
- throw new Error('NO_FMP');
53
- }
54
-
55
- return FirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {
56
- cutoffTimestamp: fmp,
57
- treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority(),
58
- // For pessimistic FMP we'll include *all* layout nodes
59
- additionalCpuNodesToTreatAsRenderBlocking: node => node.didPerformLayout(),
60
- });
61
- }
62
- }
63
-
64
- export {FirstMeaningfulPaint};
@@ -1,26 +0,0 @@
1
- export type Node = import('../base-node.js').Node;
2
- export class Interactive extends Metric {
3
- /**
4
- * @param {Node} dependencyGraph
5
- * @return {Node}
6
- */
7
- static getOptimisticGraph(dependencyGraph: Node): Node;
8
- /**
9
- * @param {Node} dependencyGraph
10
- * @return {Node}
11
- */
12
- static getPessimisticGraph(dependencyGraph: Node): Node;
13
- /**
14
- * @param {LH.Gatherer.Simulation.Result} simulationResult
15
- * @param {import('../metric.js').Extras} extras
16
- * @return {LH.Gatherer.Simulation.Result}
17
- */
18
- static getEstimateFromSimulation(simulationResult: LH.Gatherer.Simulation.Result, extras: import('../metric.js').Extras): LH.Gatherer.Simulation.Result;
19
- /**
20
- * @param {LH.Gatherer.Simulation.Result['nodeTimings']} nodeTimings
21
- * @return {number}
22
- */
23
- static getLastLongTaskEndTime(nodeTimings: LH.Gatherer.Simulation.Result['nodeTimings'], duration?: number): number;
24
- }
25
- import { Metric } from '../metric.js';
26
- //# sourceMappingURL=interactive.d.ts.map
@@ -1,19 +0,0 @@
1
- export type Node = import('../base-node.js').Node;
2
- /** @typedef {import('../base-node.js').Node} Node */
3
- export class LargestContentfulPaint extends Metric {
4
- /**
5
- * Low priority image nodes are usually offscreen and very unlikely to be the
6
- * resource that is required for LCP. Our LCP graphs include everything except for these images.
7
- *
8
- * @param {Node} node
9
- * @return {boolean}
10
- */
11
- static isNotLowPriorityImageNode(node: Node): boolean;
12
- /**
13
- * @param {LH.Gatherer.Simulation.Result} simulationResult
14
- * @return {LH.Gatherer.Simulation.Result}
15
- */
16
- static getEstimateFromSimulation(simulationResult: LH.Gatherer.Simulation.Result): LH.Gatherer.Simulation.Result;
17
- }
18
- import { Metric } from '../metric.js';
19
- //# sourceMappingURL=largest-contentful-paint.d.ts.map
@@ -1,30 +0,0 @@
1
- export type Node = import('../base-node.js').Node;
2
- /** @typedef {import('../base-node.js').Node} Node */
3
- export class MaxPotentialFID extends Metric {
4
- /**
5
- * @param {Node} dependencyGraph
6
- * @return {Node}
7
- */
8
- static getOptimisticGraph(dependencyGraph: Node): Node;
9
- /**
10
- * @param {Node} dependencyGraph
11
- * @return {Node}
12
- */
13
- static getPessimisticGraph(dependencyGraph: Node): Node;
14
- /**
15
- * @param {LH.Gatherer.Simulation.Result} simulation
16
- * @param {import('../metric.js').Extras} extras
17
- * @return {LH.Gatherer.Simulation.Result}
18
- */
19
- static getEstimateFromSimulation(simulation: LH.Gatherer.Simulation.Result, extras: import('../metric.js').Extras): LH.Gatherer.Simulation.Result;
20
- /**
21
- * @param {LH.Gatherer.Simulation.Result['nodeTimings']} nodeTimings
22
- * @param {number} fcpTimeInMs
23
- * @return {Array<{duration: number}>}
24
- */
25
- static getTimingsAfterFCP(nodeTimings: LH.Gatherer.Simulation.Result['nodeTimings'], fcpTimeInMs: number): Array<{
26
- duration: number;
27
- }>;
28
- }
29
- import { Metric } from '../metric.js';
30
- //# sourceMappingURL=max-potential-fid.d.ts.map
@@ -1,31 +0,0 @@
1
- export type Node = import('../base-node.js').Node;
2
- /** @typedef {import('../base-node.js').Node} Node */
3
- export class TotalBlockingTime extends Metric {
4
- /**
5
- * @param {Node} dependencyGraph
6
- * @return {Node}
7
- */
8
- static getOptimisticGraph(dependencyGraph: Node): Node;
9
- /**
10
- * @param {Node} dependencyGraph
11
- * @return {Node}
12
- */
13
- static getPessimisticGraph(dependencyGraph: Node): Node;
14
- /**
15
- * @param {LH.Gatherer.Simulation.Result} simulation
16
- * @param {import('../metric.js').Extras} extras
17
- * @return {LH.Gatherer.Simulation.Result}
18
- */
19
- static getEstimateFromSimulation(simulation: LH.Gatherer.Simulation.Result, extras: import('../metric.js').Extras): LH.Gatherer.Simulation.Result;
20
- /**
21
- * @param {LH.Gatherer.Simulation.Result['nodeTimings']} nodeTimings
22
- * @param {number} minDurationMs
23
- */
24
- static getTopLevelEvents(nodeTimings: LH.Gatherer.Simulation.Result['nodeTimings'], minDurationMs: number): {
25
- start: number;
26
- end: number;
27
- duration: number;
28
- }[];
29
- }
30
- import { Metric } from '../metric.js';
31
- //# sourceMappingURL=total-blocking-time.d.ts.map
@@ -1,58 +0,0 @@
1
- export type Node = import('./base-node.js').Node;
2
- export type URLArtifact = Omit<LH.Artifacts['URL'], 'finalDisplayedUrl'>;
3
- export type NetworkNodeOutput = {
4
- nodes: Array<NetworkNode>;
5
- idToNodeMap: Map<string, NetworkNode>;
6
- urlToNodeMap: Map<string, Array<NetworkNode>>;
7
- frameIdToNodeMap: Map<string, NetworkNode | null>;
8
- };
9
- export class PageDependencyGraph {
10
- /**
11
- * @param {Lantern.NetworkRequest} record
12
- * @return {Array<string>}
13
- */
14
- static getNetworkInitiators(record: Lantern.NetworkRequest): Array<string>;
15
- /**
16
- * @param {Array<Lantern.NetworkRequest>} networkRecords
17
- * @return {NetworkNodeOutput}
18
- */
19
- static getNetworkNodeOutput(networkRecords: Array<Lantern.NetworkRequest>): NetworkNodeOutput;
20
- /**
21
- * @param {LH.TraceEvent[]} mainThreadEvents
22
- * @return {Array<CPUNode>}
23
- */
24
- static getCPUNodes(mainThreadEvents: LH.TraceEvent[]): Array<CPUNode>;
25
- /**
26
- * @param {NetworkNode} rootNode
27
- * @param {NetworkNodeOutput} networkNodeOutput
28
- */
29
- static linkNetworkNodes(rootNode: NetworkNode, networkNodeOutput: NetworkNodeOutput): void;
30
- /**
31
- * @param {Node} rootNode
32
- * @param {NetworkNodeOutput} networkNodeOutput
33
- * @param {Array<CPUNode>} cpuNodes
34
- */
35
- static linkCPUNodes(rootNode: Node, networkNodeOutput: NetworkNodeOutput, cpuNodes: Array<CPUNode>): void;
36
- /**
37
- * Removes the given node from the graph, but retains all paths between its dependencies and
38
- * dependents.
39
- * @param {Node} node
40
- */
41
- static _pruneNode(node: Node): void;
42
- /**
43
- * @param {LH.TraceEvent[]} mainThreadEvents
44
- * @param {Array<Lantern.NetworkRequest>} networkRecords
45
- * @param {URLArtifact} URL
46
- * @return {Node}
47
- */
48
- static createGraph(mainThreadEvents: LH.TraceEvent[], networkRecords: Array<Lantern.NetworkRequest>, URL: URLArtifact): Node;
49
- /**
50
- *
51
- * @param {Node} rootNode
52
- */
53
- static printGraph(rootNode: Node, widthInCharacters?: number): void;
54
- }
55
- import { NetworkNode } from './network-node.js';
56
- import * as Lantern from './types/lantern.js';
57
- import { CPUNode } from './cpu-node.js';
58
- //# sourceMappingURL=page-dependency-graph.d.ts.map