lighthouse 9.5.0-dev.20220905 → 9.5.0-dev.20220907-2

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 (158) hide show
  1. package/cli/cli-flags.js +17 -0
  2. package/cli/run.js +2 -2
  3. package/cli/test/smokehouse/report-assert.js +0 -4
  4. package/cli/test/smokehouse/smokehouse.js +6 -0
  5. package/core/audits/bootup-time.js +2 -2
  6. package/core/audits/byte-efficiency/byte-efficiency-audit.js +7 -6
  7. package/core/audits/byte-efficiency/duplicated-javascript.js +1 -1
  8. package/core/audits/byte-efficiency/legacy-javascript.js +2 -2
  9. package/core/audits/byte-efficiency/modern-image-formats.js +5 -5
  10. package/core/audits/byte-efficiency/offscreen-images.js +4 -4
  11. package/core/audits/byte-efficiency/render-blocking-resources.js +5 -5
  12. package/core/audits/byte-efficiency/total-byte-weight.js +1 -1
  13. package/core/audits/byte-efficiency/unminified-css.js +1 -1
  14. package/core/audits/byte-efficiency/unused-css-rules.js +1 -1
  15. package/core/audits/byte-efficiency/unused-javascript.js +4 -4
  16. package/core/audits/byte-efficiency/uses-long-cache-ttl.js +3 -3
  17. package/core/audits/byte-efficiency/uses-optimized-images.js +5 -5
  18. package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +2 -2
  19. package/core/audits/byte-efficiency/uses-responsive-images.js +3 -3
  20. package/core/audits/byte-efficiency/uses-text-compression.js +2 -2
  21. package/core/audits/critical-request-chains.js +1 -1
  22. package/core/audits/csp-xss.js +1 -1
  23. package/core/audits/deprecations.js +2 -2
  24. package/core/audits/diagnostics.js +7 -7
  25. package/core/audits/dobetterweb/charset.js +1 -1
  26. package/core/audits/dobetterweb/uses-http2.js +8 -8
  27. package/core/audits/errors-in-console.js +2 -2
  28. package/core/audits/final-screenshot.js +2 -2
  29. package/core/audits/font-display.js +7 -6
  30. package/core/audits/image-aspect-ratio.js +3 -3
  31. package/core/audits/image-size-responsive.js +3 -3
  32. package/core/audits/installable-manifest.js +1 -1
  33. package/core/audits/is-on-https.js +3 -3
  34. package/core/audits/long-tasks.js +4 -4
  35. package/core/audits/main-thread-tasks.js +1 -1
  36. package/core/audits/mainthread-work-breakdown.js +1 -1
  37. package/core/audits/maskable-icon.js +1 -1
  38. package/core/audits/metrics/cumulative-layout-shift.js +1 -1
  39. package/core/audits/metrics/experimental-interaction-to-next-paint.js +1 -1
  40. package/core/audits/metrics/first-contentful-paint-3g.js +1 -1
  41. package/core/audits/metrics/first-contentful-paint.js +1 -1
  42. package/core/audits/metrics/first-meaningful-paint.js +1 -1
  43. package/core/audits/metrics/interactive.js +1 -1
  44. package/core/audits/metrics/largest-contentful-paint.js +1 -1
  45. package/core/audits/metrics/max-potential-fid.js +1 -1
  46. package/core/audits/metrics/speed-index.js +1 -1
  47. package/core/audits/metrics/total-blocking-time.js +1 -1
  48. package/core/audits/metrics.js +2 -2
  49. package/core/audits/network-requests.js +4 -4
  50. package/core/audits/network-rtt.js +3 -3
  51. package/core/audits/network-server-latency.js +3 -3
  52. package/core/audits/no-unload-listeners.js +2 -2
  53. package/core/audits/performance-budget.js +2 -2
  54. package/core/audits/predictive-perf.js +8 -8
  55. package/core/audits/preload-fonts.js +1 -1
  56. package/core/audits/preload-lcp-image.js +4 -4
  57. package/core/audits/redirects.js +4 -4
  58. package/core/audits/resource-summary.js +1 -1
  59. package/core/audits/screenshot-thumbnails.js +1 -1
  60. package/core/audits/script-treemap-data.js +5 -5
  61. package/core/audits/seo/canonical.js +3 -3
  62. package/core/audits/seo/font-size.js +2 -2
  63. package/core/audits/seo/http-status-code.js +1 -1
  64. package/core/audits/seo/is-crawlable.js +1 -2
  65. package/core/audits/seo/link-text.js +2 -2
  66. package/core/audits/seo/plugins.js +0 -1
  67. package/core/audits/seo/robots-txt.js +0 -1
  68. package/core/audits/seo/tap-targets.js +2 -2
  69. package/core/audits/server-response-time.js +1 -1
  70. package/core/audits/service-worker.js +0 -1
  71. package/core/audits/splash-screen.js +1 -1
  72. package/core/audits/themed-omnibox.js +1 -1
  73. package/core/audits/third-party-facades.js +3 -3
  74. package/core/audits/third-party-summary.js +2 -2
  75. package/core/audits/timing-budget.js +2 -2
  76. package/core/audits/unsized-images.js +4 -4
  77. package/core/audits/user-timings.js +1 -1
  78. package/core/audits/uses-rel-preconnect.js +12 -10
  79. package/core/audits/uses-rel-preload.js +6 -6
  80. package/core/audits/viewport.js +2 -2
  81. package/core/audits/violation-audit.js +2 -2
  82. package/core/audits/work-during-interaction.js +4 -4
  83. package/core/computed/critical-request-chains.js +5 -3
  84. package/core/computed/image-records.js +5 -3
  85. package/core/computed/js-bundles.js +2 -1
  86. package/core/computed/load-simulator.js +3 -5
  87. package/core/computed/main-resource.js +3 -2
  88. package/core/computed/main-thread-tasks.js +3 -2
  89. package/core/computed/manifest-values.js +3 -1
  90. package/core/computed/metrics/cumulative-layout-shift.js +3 -2
  91. package/core/computed/metrics/first-contentful-paint-all-frames.js +3 -2
  92. package/core/computed/metrics/first-contentful-paint.js +4 -3
  93. package/core/computed/metrics/first-meaningful-paint.js +4 -3
  94. package/core/computed/metrics/interactive.js +4 -3
  95. package/core/computed/metrics/lantern-first-contentful-paint.js +3 -2
  96. package/core/computed/metrics/lantern-first-meaningful-paint.js +4 -3
  97. package/core/computed/metrics/lantern-interactive.js +4 -3
  98. package/core/computed/metrics/lantern-largest-contentful-paint.js +4 -3
  99. package/core/computed/metrics/lantern-max-potential-fid.js +5 -4
  100. package/core/computed/metrics/lantern-metric.js +6 -6
  101. package/core/computed/metrics/lantern-speed-index.js +5 -4
  102. package/core/computed/metrics/lantern-total-blocking-time.js +5 -4
  103. package/core/computed/metrics/largest-contentful-paint-all-frames.js +3 -2
  104. package/core/computed/metrics/largest-contentful-paint.js +4 -3
  105. package/core/computed/metrics/max-potential-fid.js +4 -3
  106. package/core/computed/metrics/metric.js +3 -3
  107. package/core/computed/metrics/navigation-metric.js +4 -3
  108. package/core/computed/metrics/responsiveness.js +3 -2
  109. package/core/computed/metrics/speed-index.js +5 -4
  110. package/core/computed/metrics/timing-summary.js +15 -14
  111. package/core/computed/metrics/total-blocking-time.js +5 -4
  112. package/core/computed/module-duplication.js +5 -3
  113. package/core/computed/network-analysis.js +3 -2
  114. package/core/computed/network-records.js +2 -1
  115. package/core/computed/page-dependency-graph.js +13 -11
  116. package/core/computed/processed-navigation.js +2 -1
  117. package/core/computed/processed-trace.js +2 -1
  118. package/core/computed/resource-summary.js +4 -3
  119. package/core/computed/screenshots.js +2 -1
  120. package/core/computed/speedline.js +3 -2
  121. package/core/computed/unused-css.js +3 -2
  122. package/core/computed/unused-javascript-summary.js +2 -1
  123. package/core/computed/user-timings.js +3 -2
  124. package/core/computed/viewport-meta.js +2 -1
  125. package/core/fraggle-rock/gather/navigation-runner.js +9 -6
  126. package/core/fraggle-rock/gather/runner-helpers.js +3 -0
  127. package/core/fraggle-rock/gather/snapshot-runner.js +3 -2
  128. package/core/fraggle-rock/gather/timespan-runner.js +3 -2
  129. package/core/gather/driver/navigation.js +3 -3
  130. package/core/gather/driver/network-monitor.js +2 -2
  131. package/core/gather/gather-runner.js +3 -3
  132. package/core/gather/gatherers/dobetterweb/optimized-images.js +3 -3
  133. package/core/gather/gatherers/dobetterweb/response-compression.js +3 -3
  134. package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +1 -1
  135. package/core/gather/gatherers/inspector-issues.js +1 -1
  136. package/core/gather/gatherers/link-elements.js +1 -2
  137. package/core/gather/gatherers/main-document-content.js +1 -1
  138. package/core/gather/gatherers/script-elements.js +1 -1
  139. package/core/gather/gatherers/source-maps.js +0 -1
  140. package/core/gather/gatherers/trace-elements.js +4 -4
  141. package/core/index.js +3 -3
  142. package/core/lib/asset-saver.js +4 -4
  143. package/core/lib/dependency-graph/simulator/network-analyzer.js +2 -2
  144. package/core/lib/icons.js +0 -2
  145. package/core/lib/manifest-parser.js +0 -2
  146. package/core/lib/network-request.js +7 -7
  147. package/core/lib/{url-shim.js → url-utils.js} +4 -12
  148. package/dist/report/flow.js +11 -11
  149. package/lol.report.json +5856 -0
  150. package/package.json +1 -2
  151. package/report/test/renderer/performance-category-renderer-test.js +0 -1
  152. package/report/test/renderer/report-renderer-test.js +0 -1
  153. package/shared/localization/locales/en-US.ctc.json +8059 -0
  154. package/shared/localization/locales/en-XL.ctc.json +8036 -0
  155. package/tsconfig.json +1 -1
  156. package/types/gatherer.d.ts +2 -0
  157. package/changelog.md +0 -5902
  158. package/core/fraggle-rock/replay/stringify-extension.js +0 -104
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import {makeComputedArtifact} from '../computed-artifact.js';
12
- import NavigationMetric from './navigation-metric.js';
12
+ import {NavigationMetric} from './navigation-metric.js';
13
13
  import {LighthouseError} from '../../lib/lh-error.js';
14
14
 
15
15
  class LargestContentfulPaintAllFrames extends NavigationMetric {
@@ -38,7 +38,8 @@ class LargestContentfulPaintAllFrames extends NavigationMetric {
38
38
  }
39
39
  }
40
40
 
41
- export default makeComputedArtifact(
41
+ const LargestContentfulPaintAllFramesComputed = makeComputedArtifact(
42
42
  LargestContentfulPaintAllFrames,
43
43
  ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
44
44
  );
45
+ export {LargestContentfulPaintAllFramesComputed as LargestContentfulPaintAllFrames};
@@ -13,9 +13,9 @@
13
13
  */
14
14
 
15
15
  import {makeComputedArtifact} from '../computed-artifact.js';
16
- import NavigationMetric from './navigation-metric.js';
16
+ import {NavigationMetric} from './navigation-metric.js';
17
17
  import {LighthouseError} from '../../lib/lh-error.js';
18
- import LanternLargestContentfulPaint from './lantern-largest-contentful-paint.js';
18
+ import {LanternLargestContentfulPaint} from './lantern-largest-contentful-paint.js';
19
19
 
20
20
  class LargestContentfulPaint extends NavigationMetric {
21
21
  /**
@@ -45,7 +45,8 @@ class LargestContentfulPaint extends NavigationMetric {
45
45
  }
46
46
  }
47
47
 
48
- export default makeComputedArtifact(
48
+ const LargestContentfulPaintComputed = makeComputedArtifact(
49
49
  LargestContentfulPaint,
50
50
  ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
51
51
  );
52
+ export {LargestContentfulPaintComputed as LargestContentfulPaint};
@@ -5,8 +5,8 @@
5
5
  */
6
6
 
7
7
  import {makeComputedArtifact} from '../computed-artifact.js';
8
- import NavigationMetric from './navigation-metric.js';
9
- import LanternMaxPotentialFID from './lantern-max-potential-fid.js';
8
+ import {NavigationMetric} from './navigation-metric.js';
9
+ import {LanternMaxPotentialFID} from './lantern-max-potential-fid.js';
10
10
  import {TraceProcessor} from '../../lib/tracehouse/trace-processor.js';
11
11
 
12
12
  class MaxPotentialFID extends NavigationMetric {
@@ -38,7 +38,8 @@ class MaxPotentialFID extends NavigationMetric {
38
38
  }
39
39
  }
40
40
 
41
- export default makeComputedArtifact(
41
+ const MaxPotentialFIDComputed = makeComputedArtifact(
42
42
  MaxPotentialFID,
43
43
  ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
44
44
  );
45
+ export {MaxPotentialFIDComputed as MaxPotentialFID};
@@ -5,9 +5,9 @@
5
5
  */
6
6
 
7
7
  import {TraceProcessor} from '../../lib/tracehouse/trace-processor.js';
8
- import ProcessedTrace from '../processed-trace.js';
9
- import ProcessedNavigation from '../processed-navigation.js';
10
- import NetworkRecords from '../network-records.js';
8
+ import {ProcessedTrace} from '../processed-trace.js';
9
+ import {ProcessedNavigation} from '../processed-navigation.js';
10
+ import {NetworkRecords} from '../network-records.js';
11
11
 
12
12
  /**
13
13
  * @fileOverview Encapsulates logic for choosing the correct metric computation method based on the
@@ -4,11 +4,12 @@
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 Metric from './metric.js';
8
-
9
7
  /**
10
8
  * @fileOverview Enforces that a metric can only be computed on navigations.
11
9
  */
10
+
11
+ import Metric from './metric.js';
12
+
12
13
  class NavigationMetric extends Metric {
13
14
  /**
14
15
  * @param {LH.Artifacts.NavigationMetricComputationData} data
@@ -42,4 +43,4 @@ class NavigationMetric extends Metric {
42
43
  }
43
44
  }
44
45
 
45
- export default NavigationMetric;
46
+ export {NavigationMetric};
@@ -30,7 +30,7 @@
30
30
  * @typedef {{name: 'FallbackTiming', duration: number}} FallbackTimingEvent
31
31
  */
32
32
 
33
- import ProcessedTrace from '../processed-trace.js';
33
+ import {ProcessedTrace} from '../processed-trace.js';
34
34
  import {makeComputedArtifact} from '../computed-artifact.js';
35
35
 
36
36
  const KEYBOARD_EVENTS = new Set(['keydown', 'keypress', 'keyup']);
@@ -150,7 +150,8 @@ class Responsiveness {
150
150
  }
151
151
  }
152
152
 
153
- export default makeComputedArtifact(Responsiveness, [
153
+ const ResponsivenessComputed = makeComputedArtifact(Responsiveness, [
154
154
  'trace',
155
155
  'settings',
156
156
  ]);
157
+ export {ResponsivenessComputed as Responsiveness};
@@ -5,9 +5,9 @@
5
5
  */
6
6
 
7
7
  import {makeComputedArtifact} from '../computed-artifact.js';
8
- import NavigationMetric from './navigation-metric.js';
9
- import LanternSpeedIndex from './lantern-speed-index.js';
10
- import Speedline from '../speedline.js';
8
+ import {NavigationMetric} from './navigation-metric.js';
9
+ import {LanternSpeedIndex} from './lantern-speed-index.js';
10
+ import {Speedline} from '../speedline.js';
11
11
 
12
12
  class SpeedIndex extends NavigationMetric {
13
13
  /**
@@ -33,7 +33,8 @@ class SpeedIndex extends NavigationMetric {
33
33
  }
34
34
  }
35
35
 
36
- export default makeComputedArtifact(
36
+ const SpeedIndexComputed = makeComputedArtifact(
37
37
  SpeedIndex,
38
38
  ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
39
39
  );
40
+ export {SpeedIndexComputed as SpeedIndex};
@@ -4,19 +4,19 @@
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 ProcessedTrace from '../processed-trace.js';
8
- import ProcessedNavigation from '../processed-navigation.js';
9
- import Speedline from '../speedline.js';
10
- import FirstContentfulPaint from './first-contentful-paint.js';
11
- import FirstContentfulPaintAllFrames from './first-contentful-paint-all-frames.js';
12
- import FirstMeaningfulPaint from './first-meaningful-paint.js';
13
- import LargestContentfulPaint from './largest-contentful-paint.js';
14
- import LargestContentfulPaintAllFrames from './largest-contentful-paint-all-frames.js';
15
- import Interactive from './interactive.js';
16
- import CumulativeLayoutShift from './cumulative-layout-shift.js';
17
- import SpeedIndex from './speed-index.js';
18
- import MaxPotentialFID from './max-potential-fid.js';
19
- import TotalBlockingTime from './total-blocking-time.js';
7
+ import {ProcessedTrace} from '../processed-trace.js';
8
+ import {ProcessedNavigation} from '../processed-navigation.js';
9
+ import {Speedline} from '../speedline.js';
10
+ import {FirstContentfulPaint} from './first-contentful-paint.js';
11
+ import {FirstContentfulPaintAllFrames} from './first-contentful-paint-all-frames.js';
12
+ import {FirstMeaningfulPaint} from './first-meaningful-paint.js';
13
+ import {LargestContentfulPaint} from './largest-contentful-paint.js';
14
+ import {LargestContentfulPaintAllFrames} from './largest-contentful-paint-all-frames.js';
15
+ import {Interactive} from './interactive.js';
16
+ import {CumulativeLayoutShift} from './cumulative-layout-shift.js';
17
+ import {SpeedIndex} from './speed-index.js';
18
+ import {MaxPotentialFID} from './max-potential-fid.js';
19
+ import {TotalBlockingTime} from './total-blocking-time.js';
20
20
  import {makeComputedArtifact} from '../computed-artifact.js';
21
21
 
22
22
  class TimingSummary {
@@ -150,7 +150,8 @@ class TimingSummary {
150
150
  }
151
151
  }
152
152
 
153
- export default makeComputedArtifact(
153
+ const TimingSummaryComputed = makeComputedArtifact(
154
154
  TimingSummary,
155
155
  ['devtoolsLog', 'gatherContext', 'settings', 'trace', 'URL']
156
156
  );
157
+ export {TimingSummaryComputed as TimingSummary};
@@ -7,8 +7,8 @@
7
7
  import {makeComputedArtifact} from '../computed-artifact.js';
8
8
  import ComputedMetric from './metric.js';
9
9
  import {TraceProcessor} from '../../lib/tracehouse/trace-processor.js';
10
- import LanternTotalBlockingTime from './lantern-total-blocking-time.js';
11
- import TimetoInteractive from './interactive.js';
10
+ import {LanternTotalBlockingTime} from './lantern-total-blocking-time.js';
11
+ import {Interactive} from './interactive.js';
12
12
  import {calculateSumOfBlockingTime} from './tbt-utils.js';
13
13
 
14
14
  /**
@@ -46,7 +46,7 @@ class TotalBlockingTime extends ComputedMetric {
46
46
  if (data.processedNavigation) {
47
47
  const {firstContentfulPaint} = data.processedNavigation.timings;
48
48
  const metricData = ComputedMetric.getMetricComputationInput(data);
49
- const interactiveTimeMs = (await TimetoInteractive.request(metricData, context)).timing;
49
+ const interactiveTimeMs = (await Interactive.request(metricData, context)).timing;
50
50
 
51
51
  return {
52
52
  timing: calculateSumOfBlockingTime(
@@ -67,7 +67,8 @@ class TotalBlockingTime extends ComputedMetric {
67
67
  }
68
68
  }
69
69
 
70
- export default makeComputedArtifact(
70
+ const TotalBlockingTimeComputed = makeComputedArtifact(
71
71
  TotalBlockingTime,
72
72
  ['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL']
73
73
  );
74
+ export {TotalBlockingTimeComputed as TotalBlockingTime};
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import {makeComputedArtifact} from './computed-artifact.js';
8
- import JsBundles from './js-bundles.js';
8
+ import {JSBundles} from './js-bundles.js';
9
9
 
10
10
  const RELATIVE_SIZE_THRESHOLD = 0.1;
11
11
  const ABSOLUTE_SIZE_THRESHOLD_BYTES = 1024 * 0.5;
@@ -77,7 +77,7 @@ class ModuleDuplication {
77
77
  * @param {LH.Artifacts.ComputedContext} context
78
78
  */
79
79
  static async compute_(artifacts, context) {
80
- const bundles = await JsBundles.request(artifacts, context);
80
+ const bundles = await JSBundles.request(artifacts, context);
81
81
 
82
82
  /**
83
83
  * @typedef SourceData
@@ -133,4 +133,6 @@ class ModuleDuplication {
133
133
  }
134
134
  }
135
135
 
136
- export default makeComputedArtifact(ModuleDuplication, ['Scripts', 'SourceMaps']);
136
+ const ModuleDuplicationComputed =
137
+ makeComputedArtifact(ModuleDuplication, ['Scripts', 'SourceMaps']);
138
+ export {ModuleDuplicationComputed as ModuleDuplication};
@@ -6,7 +6,7 @@
6
6
 
7
7
  import {makeComputedArtifact} from './computed-artifact.js';
8
8
  import {NetworkAnalyzer} from '../lib/dependency-graph/simulator/network-analyzer.js';
9
- import NetworkRecords from './network-records.js';
9
+ import {NetworkRecords} from './network-records.js';
10
10
 
11
11
  class NetworkAnalysis {
12
12
  /**
@@ -60,4 +60,5 @@ class NetworkAnalysis {
60
60
  }
61
61
  }
62
62
 
63
- export default makeComputedArtifact(NetworkAnalysis, null);
63
+ const NetworkAnalysisComputed = makeComputedArtifact(NetworkAnalysis, null);
64
+ export {NetworkAnalysisComputed as NetworkAnalysis};
@@ -17,4 +17,5 @@ class NetworkRecords {
17
17
  }
18
18
  }
19
19
 
20
- export default makeComputedArtifact(NetworkRecords, null);
20
+ const NetworkRecordsComputed = makeComputedArtifact(NetworkRecords, null);
21
+ export {NetworkRecordsComputed as NetworkRecords};
@@ -9,13 +9,21 @@ import {NetworkNode} from '../lib/dependency-graph/network-node.js';
9
9
  import {CPUNode} from '../lib/dependency-graph/cpu-node.js';
10
10
  import {TraceProcessor} from '../lib/tracehouse/trace-processor.js';
11
11
  import {NetworkRequest} from '../lib/network-request.js';
12
- import ProcessedTrace from './processed-trace.js';
13
- import NetworkRecords from './network-records.js';
12
+ import {ProcessedTrace} from './processed-trace.js';
13
+ import {NetworkRecords} from './network-records.js';
14
14
  import {NetworkAnalyzer} from '../lib/dependency-graph/simulator/network-analyzer.js';
15
15
 
16
16
  /** @typedef {import('../lib/dependency-graph/base-node.js').Node} Node */
17
17
  /** @typedef {Omit<LH.Artifacts['URL'], 'initialUrl'|'finalUrl'>} URLArtifact */
18
18
 
19
+ /**
20
+ * @typedef {Object} NetworkNodeOutput
21
+ * @property {Array<NetworkNode>} nodes
22
+ * @property {Map<string, NetworkNode>} idToNodeMap
23
+ * @property {Map<string, Array<NetworkNode>>} urlToNodeMap
24
+ * @property {Map<string, NetworkNode|null>} frameIdToNodeMap
25
+ */
26
+
19
27
  // Shorter tasks have negligible impact on simulation results.
20
28
  const SIGNIFICANT_DUR_THRESHOLD_MS = 10;
21
29
 
@@ -503,12 +511,6 @@ class PageDependencyGraph {
503
511
  }
504
512
  }
505
513
 
506
- export default makeComputedArtifact(PageDependencyGraph, ['devtoolsLog', 'trace', 'URL']);
507
-
508
- /**
509
- * @typedef {Object} NetworkNodeOutput
510
- * @property {Array<NetworkNode>} nodes
511
- * @property {Map<string, NetworkNode>} idToNodeMap
512
- * @property {Map<string, Array<NetworkNode>>} urlToNodeMap
513
- * @property {Map<string, NetworkNode|null>} frameIdToNodeMap
514
- */
514
+ const PageDependencyGraphComputed =
515
+ makeComputedArtifact(PageDependencyGraph, ['devtoolsLog', 'trace', 'URL']);
516
+ export {PageDependencyGraphComputed as PageDependencyGraph};
@@ -17,4 +17,5 @@ class ProcessedNavigation {
17
17
  }
18
18
  }
19
19
 
20
- export default makeComputedArtifact(ProcessedNavigation, null);
20
+ const ProcessedNavigationComputed = makeComputedArtifact(ProcessedNavigation, null);
21
+ export {ProcessedNavigationComputed as ProcessedNavigation};
@@ -17,4 +17,5 @@ class ProcessedTrace {
17
17
  }
18
18
  }
19
19
 
20
- export default makeComputedArtifact(ProcessedTrace, null);
20
+ const ProcessedTraceComputed = makeComputedArtifact(ProcessedTrace, null);
21
+ export {ProcessedTraceComputed as ProcessedTrace};
@@ -5,8 +5,7 @@
5
5
  */
6
6
 
7
7
  import {makeComputedArtifact} from './computed-artifact.js';
8
- import NetworkRecords from './network-records.js';
9
- import URL from '../lib/url-shim.js';
8
+ import {NetworkRecords} from './network-records.js';
10
9
  import {NetworkRequest} from '../lib/network-request.js';
11
10
  import {Budget} from '../config/budget.js';
12
11
  import {Util} from '../util.cjs';
@@ -110,4 +109,6 @@ class ResourceSummary {
110
109
  }
111
110
  }
112
111
 
113
- export default makeComputedArtifact(ResourceSummary, ['URL', 'devtoolsLog', 'budgets']);
112
+ const ResourceSummaryComputed =
113
+ makeComputedArtifact(ResourceSummary, ['URL', 'devtoolsLog', 'budgets']);
114
+ export {ResourceSummaryComputed as ResourceSummary};
@@ -25,4 +25,5 @@ class Screenshots {
25
25
  }
26
26
  }
27
27
 
28
- export default makeComputedArtifact(Screenshots, null);
28
+ const ScreenshotsComputed = makeComputedArtifact(Screenshots, null);
29
+ export {ScreenshotsComputed as Screenshots};
@@ -8,7 +8,7 @@ import speedline from 'speedline-core';
8
8
 
9
9
  import {makeComputedArtifact} from './computed-artifact.js';
10
10
  import {LighthouseError} from '../lib/lh-error.js';
11
- import ProcessedTrace from './processed-trace.js';
11
+ import {ProcessedTrace} from './processed-trace.js';
12
12
 
13
13
  class Speedline {
14
14
  /**
@@ -51,4 +51,5 @@ class Speedline {
51
51
  }
52
52
  }
53
53
 
54
- export default makeComputedArtifact(Speedline, null);
54
+ const SpeedlineComputed = makeComputedArtifact(Speedline, null);
55
+ export {SpeedlineComputed as Speedline};
@@ -6,7 +6,7 @@
6
6
 
7
7
  import {makeComputedArtifact} from './computed-artifact.js';
8
8
  import {ByteEfficiencyAudit} from '../audits/byte-efficiency/byte-efficiency-audit.js';
9
- import NetworkRecords from './network-records.js';
9
+ import {NetworkRecords} from './network-records.js';
10
10
 
11
11
  const PREVIEW_LENGTH = 100;
12
12
 
@@ -149,4 +149,5 @@ class UnusedCSS {
149
149
  }
150
150
  }
151
151
 
152
- export default makeComputedArtifact(UnusedCSS, ['CSSUsage', 'devtoolsLog']);
152
+ const UnusedCSSComputed = makeComputedArtifact(UnusedCSS, ['CSSUsage', 'devtoolsLog']);
153
+ export {UnusedCSSComputed as UnusedCSS};
@@ -148,7 +148,8 @@ class UnusedJavascriptSummary {
148
148
  }
149
149
  }
150
150
 
151
- export default makeComputedArtifact(
151
+ const UnusedJavascriptSummaryComputed = makeComputedArtifact(
152
152
  UnusedJavascriptSummary,
153
153
  ['bundle', 'scriptCoverage', 'scriptId']
154
154
  );
155
+ export {UnusedJavascriptSummaryComputed as UnusedJavascriptSummary};
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import {makeComputedArtifact} from './computed-artifact.js';
8
- import ProcessedTrace from './processed-trace.js';
8
+ import {ProcessedTrace} from './processed-trace.js';
9
9
 
10
10
  /** @typedef {{name: string, isMark: true, args: LH.TraceEvent['args'], startTime: number}} MarkEvent */
11
11
  /** @typedef {{name: string, isMark: false, args: LH.TraceEvent['args'], startTime: number, endTime: number, duration: number}} MeasureEvent */
@@ -79,4 +79,5 @@ class UserTimings {
79
79
  }
80
80
  }
81
81
 
82
- export default makeComputedArtifact(UserTimings, null);
82
+ const UserTimingsComputed = makeComputedArtifact(UserTimings, null);
83
+ export {UserTimingsComputed as UserTimings};
@@ -45,7 +45,8 @@ class ViewportMeta {
45
45
  }
46
46
  }
47
47
 
48
- export default makeComputedArtifact(ViewportMeta, null);
48
+ const ViewportMetaComputed = makeComputedArtifact(ViewportMeta, null);
49
+ export {ViewportMetaComputed as ViewportMeta};
49
50
 
50
51
  /**
51
52
  * @typedef {object} ViewportMetaResult
@@ -19,15 +19,16 @@ import {initializeConfig} from '../config/config.js';
19
19
  import {getBaseArtifacts, finalizeArtifacts} from './base-artifacts.js';
20
20
  import * as format from '../../../shared/localization/format.js';
21
21
  import {LighthouseError} from '../../lib/lh-error.js';
22
- import URL from '../../lib/url-shim.js';
22
+ import UrlUtils from '../../lib/url-utils.js';
23
23
  import {getPageLoadError} from '../../lib/navigation-error.js';
24
24
  import Trace from '../../gather/gatherers/trace.js';
25
25
  import DevtoolsLog from '../../gather/gatherers/devtools-log.js';
26
- import NetworkRecords from '../../computed/network-records.js';
26
+ import {NetworkRecords} from '../../computed/network-records.js';
27
27
 
28
28
  /**
29
29
  * @typedef NavigationContext
30
30
  * @property {Driver} driver
31
+ * @property {LH.Puppeteer.Page} page
31
32
  * @property {LH.Config.FRConfig} config
32
33
  * @property {LH.Config.NavigationDefn} navigation
33
34
  * @property {LH.NavigationRequestor} requestor
@@ -218,6 +219,7 @@ async function _navigation(navigationContext) {
218
219
  url: initialUrl,
219
220
  gatherMode: /** @type {const} */ ('navigation'),
220
221
  driver: navigationContext.driver,
222
+ page: navigationContext.page,
221
223
  computedCache: navigationContext.computedCache,
222
224
  artifactDefinitions: navigationContext.navigation.artifacts,
223
225
  artifactState,
@@ -250,10 +252,10 @@ async function _navigation(navigationContext) {
250
252
  }
251
253
 
252
254
  /**
253
- * @param {{driver: Driver, config: LH.Config.FRConfig, requestor: LH.NavigationRequestor; baseArtifacts: LH.FRBaseArtifacts, computedCache: NavigationContext['computedCache']}} args
255
+ * @param {{driver: Driver, page: LH.Puppeteer.Page, config: LH.Config.FRConfig, requestor: LH.NavigationRequestor; baseArtifacts: LH.FRBaseArtifacts, computedCache: NavigationContext['computedCache']}} args
254
256
  * @return {Promise<{artifacts: Partial<LH.FRArtifacts & LH.FRBaseArtifacts>}>}
255
257
  */
256
- async function _navigations({driver, config, requestor, baseArtifacts, computedCache}) {
258
+ async function _navigations({driver, page, config, requestor, baseArtifacts, computedCache}) {
257
259
  if (!config.navigations) throw new Error('No navigations configured');
258
260
 
259
261
  /** @type {Partial<LH.FRArtifacts & LH.FRBaseArtifacts>} */
@@ -264,6 +266,7 @@ async function _navigations({driver, config, requestor, baseArtifacts, computedC
264
266
  for (const navigation of config.navigations) {
265
267
  const navigationContext = {
266
268
  driver,
269
+ page,
267
270
  navigation,
268
271
  requestor,
269
272
  config,
@@ -316,7 +319,7 @@ async function navigationGather(requestor, options) {
316
319
  const artifacts = await Runner.gather(
317
320
  async () => {
318
321
  let {page} = options;
319
- const normalizedRequestor = isCallback ? requestor : URL.normalizeUrl(requestor);
322
+ const normalizedRequestor = isCallback ? requestor : UrlUtils.normalizeUrl(requestor);
320
323
 
321
324
  // For navigation mode, we shouldn't connect to a browser in audit mode,
322
325
  // therefore we connect to the browser in the gatherFn callback.
@@ -333,7 +336,7 @@ async function navigationGather(requestor, options) {
333
336
  requestor: normalizedRequestor,
334
337
  };
335
338
  const {baseArtifacts} = await _setup(context);
336
- const {artifacts} = await _navigations({...context, baseArtifacts, computedCache});
339
+ const {artifacts} = await _navigations({...context, page, baseArtifacts, computedCache});
337
340
  await _cleanup(context);
338
341
 
339
342
  return finalizeArtifacts(baseArtifacts, artifacts);
@@ -7,6 +7,7 @@
7
7
  /**
8
8
  * @typedef CollectPhaseArtifactOptions
9
9
  * @property {import('./driver.js').Driver} driver
10
+ * @property {LH.Puppeteer.Page} page
10
11
  * @property {Array<LH.Config.AnyArtifactDefn>} artifactDefinitions
11
12
  * @property {ArtifactState} artifactState
12
13
  * @property {LH.FRBaseArtifacts} baseArtifacts
@@ -66,6 +67,7 @@ const phaseToPriorPhase = {
66
67
  async function collectPhaseArtifacts(options) {
67
68
  const {
68
69
  driver,
70
+ page,
69
71
  artifactDefinitions,
70
72
  artifactState,
71
73
  baseArtifacts,
@@ -91,6 +93,7 @@ async function collectPhaseArtifacts(options) {
91
93
  return gatherer[phase]({
92
94
  gatherMode,
93
95
  driver,
96
+ page,
94
97
  baseArtifacts,
95
98
  dependencies,
96
99
  computedCache,
@@ -17,11 +17,11 @@ import {getBaseArtifacts, finalizeArtifacts} from './base-artifacts.js';
17
17
  * @return {Promise<LH.Gatherer.FRGatherResult>}
18
18
  */
19
19
  async function snapshotGather(options) {
20
- const {flags = {}} = options;
20
+ const {page, flags = {}} = options;
21
21
  log.setLevel(flags.logLevel || 'error');
22
22
 
23
23
  const {config} = await initializeConfig('snapshot', options.config, flags);
24
- const driver = new Driver(options.page);
24
+ const driver = new Driver(page);
25
25
  await driver.connect();
26
26
 
27
27
  /** @type {Map<string, LH.ArbitraryEqualityMap>} */
@@ -43,6 +43,7 @@ async function snapshotGather(options) {
43
43
  phase: 'getArtifact',
44
44
  gatherMode: 'snapshot',
45
45
  driver,
46
+ page,
46
47
  baseArtifacts,
47
48
  artifactDefinitions,
48
49
  artifactState,
@@ -18,11 +18,11 @@ import {getBaseArtifacts, finalizeArtifacts} from './base-artifacts.js';
18
18
  * @return {Promise<{endTimespanGather(): Promise<LH.Gatherer.FRGatherResult>}>}
19
19
  */
20
20
  async function startTimespanGather(options) {
21
- const {flags = {}} = options;
21
+ const {page, flags = {}} = options;
22
22
  log.setLevel(flags.logLevel || 'error');
23
23
 
24
24
  const {config} = await initializeConfig('timespan', options.config, flags);
25
- const driver = new Driver(options.page);
25
+ const driver = new Driver(page);
26
26
  await driver.connect();
27
27
 
28
28
  /** @type {Map<string, LH.ArbitraryEqualityMap>} */
@@ -34,6 +34,7 @@ async function startTimespanGather(options) {
34
34
  /** @type {Omit<import('./runner-helpers.js').CollectPhaseArtifactOptions, 'phase'>} */
35
35
  const phaseOptions = {
36
36
  driver,
37
+ page,
37
38
  artifactDefinitions,
38
39
  artifactState,
39
40
  baseArtifacts,
@@ -10,7 +10,7 @@ import {NetworkMonitor} from './network-monitor.js';
10
10
  import {waitForFullyLoaded, waitForFrameNavigated, waitForUserToContinue} from './wait-for-condition.js'; // eslint-disable-line max-len
11
11
  import * as constants from '../../config/constants.js';
12
12
  import * as i18n from '../../lib/i18n/i18n.js';
13
- import URL from '../../lib/url-shim.js';
13
+ import UrlUtils from '../../lib/url-utils.js';
14
14
 
15
15
  const UIStrings = {
16
16
  /**
@@ -130,7 +130,7 @@ async function gotoURL(driver, requestor, options) {
130
130
 
131
131
  let requestedUrl = navigationUrls.requestedUrl;
132
132
  if (typeof requestor === 'string') {
133
- if (requestedUrl && !URL.equalWithExcludedFragments(requestor, requestedUrl)) {
133
+ if (requestedUrl && !UrlUtils.equalWithExcludedFragments(requestor, requestedUrl)) {
134
134
  log.error(
135
135
  'Navigation',
136
136
  `Provided URL (${requestor}) did not match initial navigation URL (${requestedUrl})`
@@ -169,7 +169,7 @@ function getNavigationWarnings(navigation) {
169
169
 
170
170
  if (navigation.timedOut) warnings.push(str_(UIStrings.warningTimeout));
171
171
 
172
- if (!URL.equalWithExcludedFragments(requestedUrl, mainDocumentUrl)) {
172
+ if (!UrlUtils.equalWithExcludedFragments(requestedUrl, mainDocumentUrl)) {
173
173
  warnings.push(str_(UIStrings.warningRedirected, {
174
174
  requested: requestedUrl,
175
175
  final: mainDocumentUrl,
@@ -15,7 +15,7 @@ import log from 'lighthouse-logger';
15
15
 
16
16
  import {NetworkRecorder} from '../../lib/network-recorder.js';
17
17
  import {NetworkRequest} from '../../lib/network-request.js';
18
- import URL from '../../lib/url-shim.js';
18
+ import UrlUtils from '../../lib/url-utils.js';
19
19
 
20
20
  /** @typedef {import('../../lib/network-recorder.js').NetworkRecorderEventMap} NetworkRecorderEventMap */
21
21
  /** @typedef {'network-2-idle'|'network-critical-idle'|'networkidle'|'networkbusy'|'network-critical-busy'|'network-2-busy'} NetworkMonitorEvent_ */
@@ -214,7 +214,7 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
214
214
  /** @type {Array<{time: number, isStart: boolean}>} */
215
215
  let timeBoundaries = [];
216
216
  requests.forEach(request => {
217
- if (URL.isNonNetworkProtocol(request.protocol)) return;
217
+ if (UrlUtils.isNonNetworkProtocol(request.protocol)) return;
218
218
  if (request.protocol === 'ws' || request.protocol === 'wss') return;
219
219
 
220
220
  // convert the network timestamp to ms
@@ -6,7 +6,7 @@
6
6
 
7
7
  import log from 'lighthouse-logger';
8
8
 
9
- import NetworkRecords from '../computed/network-records.js';
9
+ import {NetworkRecords} from '../computed/network-records.js';
10
10
  import {getPageLoadError} from '../lib/navigation-error.js';
11
11
  import * as emulation from '../lib/emulation.js';
12
12
  import * as constants from '../config/constants.js';
@@ -21,7 +21,7 @@ import InstallabilityErrors from './gatherers/installability-errors.js';
21
21
  import NetworkUserAgent from './gatherers/network-user-agent.js';
22
22
  import Stacks from './gatherers/stacks.js';
23
23
  import {finalizeArtifacts} from '../fraggle-rock/gather/base-artifacts.js';
24
- import URLShim from '../lib/url-shim.js';
24
+ import UrlUtils from '../lib/url-utils.js';
25
25
 
26
26
  /** @typedef {import('../gather/driver.js').Driver} Driver */
27
27
  /** @typedef {import('../lib/arbitrary-equality-map.js').ArbitraryEqualityMap} ArbitraryEqualityMap */
@@ -494,7 +494,7 @@ class GatherRunner {
494
494
 
495
495
  // Hack for running benchmarkIndex extra times.
496
496
  // Add a `bidx=20` query param, eg: https://www.example.com/?bidx=50
497
- const parsedUrl = URLShim.isValid(options.requestedUrl) && new URL(options.requestedUrl);
497
+ const parsedUrl = UrlUtils.isValid(options.requestedUrl) && new URL(options.requestedUrl);
498
498
  if (options.settings.channel === 'lr' && parsedUrl && parsedUrl.searchParams.has('bidx')) {
499
499
  const bidxRunCount = parsedUrl.searchParams.get('bidx') || 0;
500
500
  // Add the first bidx into the new set