lighthouse 13.6.0-dev.20261112 → 13.6.0-dev.20261116

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 (98) hide show
  1. package/.agents/skills/update-ard-port/SKILL.md +1 -1
  2. package/cli/bin.js +8 -3
  3. package/cli/open-file.js +1 -1
  4. package/cli/printer.js +1 -1
  5. package/cli/run.js +4 -2
  6. package/cli/sentry-prompt.js +2 -1
  7. package/cli/test/smokehouse/frontends/smokehouse-bin.js +1 -1
  8. package/cli/test/smokehouse/lighthouse-runners/cli.js +1 -2
  9. package/cli/test/smokehouse/report-assert.js +1 -2
  10. package/cli/test/smokehouse/smokehouse.js +1 -2
  11. package/core/audits/autocomplete.js +1 -2
  12. package/core/audits/bootup-time.js +1 -2
  13. package/core/audits/errors-in-console.js +1 -2
  14. package/core/audits/mainthread-work-breakdown.js +1 -2
  15. package/core/audits/metrics.d.ts +2 -2
  16. package/core/audits/metrics.js +1 -1
  17. package/core/computed/computed-artifact.js +1 -2
  18. package/core/computed/entity-classification.d.ts +3 -3
  19. package/core/computed/entity-classification.js +5 -3
  20. package/core/computed/js-bundles.js +1 -2
  21. package/core/computed/load-simulator.d.ts +5 -3
  22. package/core/computed/load-simulator.js +9 -2
  23. package/core/computed/metrics/responsiveness.d.ts +5 -3
  24. package/core/computed/metrics/responsiveness.js +1 -1
  25. package/core/computed/metrics/time-to-first-byte.js +3 -1
  26. package/core/computed/metrics/timing-summary.d.ts +7 -5
  27. package/core/computed/metrics/timing-summary.js +3 -4
  28. package/core/computed/navigation-insights.d.ts +5 -3
  29. package/core/computed/navigation-insights.js +1 -1
  30. package/core/computed/network-analysis.js +1 -2
  31. package/core/computed/page-dependency-graph.d.ts +5 -3
  32. package/core/computed/page-dependency-graph.js +1 -1
  33. package/core/computed/trace-engine-result.d.ts +7 -5
  34. package/core/computed/trace-engine-result.js +9 -5
  35. package/core/computed/unused-css.d.ts +2 -2
  36. package/core/computed/unused-css.js +1 -1
  37. package/core/config/config.js +1 -2
  38. package/core/gather/base-artifacts.js +1 -2
  39. package/core/gather/driver/environment.js +1 -2
  40. package/core/gather/driver/navigation.js +1 -2
  41. package/core/gather/driver/network-monitor.js +1 -2
  42. package/core/gather/driver/prepare.js +1 -2
  43. package/core/gather/driver/storage.js +1 -2
  44. package/core/gather/driver/target-manager.js +1 -2
  45. package/core/gather/driver/wait-for-condition.js +1 -2
  46. package/core/gather/driver.js +1 -2
  47. package/core/gather/gatherers/agentic/ard.js +1 -1
  48. package/core/gather/gatherers/agentic/llms-txt.js +1 -2
  49. package/core/gather/gatherers/image-elements.js +1 -2
  50. package/core/gather/gatherers/seo/robots-txt.js +1 -2
  51. package/core/gather/gatherers/stacks.js +1 -2
  52. package/core/gather/gatherers/stylesheets.js +1 -2
  53. package/core/gather/navigation-runner.js +1 -1
  54. package/core/gather/runner-helpers.js +1 -2
  55. package/core/gather/session.js +1 -2
  56. package/core/gather/snapshot-runner.js +1 -2
  57. package/core/gather/timespan-runner.js +1 -2
  58. package/core/lib/asset-saver.js +1 -2
  59. package/core/lib/csp-evaluator.js +1 -1
  60. package/core/lib/i18n/i18n.js +1 -2
  61. package/core/lib/lighthouse-logger.d.ts +127 -0
  62. package/core/lib/lighthouse-logger.js +319 -0
  63. package/core/lib/median-run.d.ts +16 -6
  64. package/core/lib/median-run.js +13 -6
  65. package/core/lib/network-recorder.js +1 -2
  66. package/core/lib/network-request.d.ts +2 -2
  67. package/core/lib/network-request.js +1 -1
  68. package/core/lib/page-functions.js +2 -2
  69. package/core/lib/script-helpers.d.ts +23 -8
  70. package/core/lib/script-helpers.js +7 -6
  71. package/core/lib/sentry-reporter.d.ts +59 -0
  72. package/core/lib/sentry-reporter.js +281 -0
  73. package/core/lib/sentry.d.ts +7 -7
  74. package/core/lib/sentry.js +23 -40
  75. package/core/lib/stack-packs.js +1 -1
  76. package/core/lib/timing-trace-saver.d.ts +2 -2
  77. package/core/lib/timing-trace-saver.js +1 -1
  78. package/core/lib/tracehouse/task-summary.d.ts +16 -4
  79. package/core/lib/tracehouse/task-summary.js +6 -5
  80. package/core/lib/tracehouse/trace-processor.d.ts +6 -6
  81. package/core/lib/tracehouse/trace-processor.js +1 -1
  82. package/core/lib/traces/metric-trace-events.js +1 -2
  83. package/core/lib/url-utils.d.ts +4 -4
  84. package/core/lib/url-utils.js +1 -1
  85. package/core/runner.js +1 -2
  86. package/dist/report/bundle.esm.js +10 -10
  87. package/dist/report/flow.js +12 -12
  88. package/dist/report/standalone.js +11 -11
  89. package/package.json +2 -4
  90. package/report/renderer/text-encoding.d.ts +3 -5
  91. package/report/renderer/text-encoding.js +19 -33
  92. package/report/types/augment-dom.d.ts +0 -4
  93. package/third-party/ard/README.md +1 -1
  94. package/third-party/ard/ard.js +1 -1
  95. package/tsconfig.json +2 -42
  96. package/types/artifacts.d.ts +7 -1
  97. package/types/internal/test.d.ts +5 -0
  98. package/report/types/buffer.d.ts +0 -19
@@ -79,7 +79,7 @@ For every hunk in the upstream `conformance-test` diff decide whether it touches
79
79
  Rules to preserve:
80
80
  - Treat non-object roots/entries as empty instead of throwing.
81
81
  - Push `{element, message}` objects; never return formatted strings.
82
- - Log through `lighthouse-logger`, not `console`.
82
+ - Log through `core/lib/lighthouse-logger.js`, not `console`.
83
83
  - Only `ARD_VERSION`, `ConformanceTester` and `classify_media_type` are exported; add exports only if
84
84
  tests need them.
85
85
 
package/cli/bin.js CHANGED
@@ -21,8 +21,7 @@ import fs from 'fs';
21
21
  import path from 'path';
22
22
  import url from 'url';
23
23
 
24
- import log from 'lighthouse-logger';
25
-
24
+ import log from '../core/lib/lighthouse-logger.js';
26
25
  import * as commands from './commands/commands.js';
27
26
  import * as Printer from './printer.js';
28
27
  import {getFlags} from './cli-flags.js';
@@ -132,7 +131,13 @@ async function begin() {
132
131
  });
133
132
  }
134
133
 
135
- return runLighthouse(urlsUnderTest, cliFlags, config);
134
+ try {
135
+ return await runLighthouse(urlsUnderTest, cliFlags, config);
136
+ } catch (err) {
137
+ // Report fatal CLI errors before Node exits (unhandled rejections are reported in run.js).
138
+ await Sentry.captureException(err, {level: 'fatal'});
139
+ throw err;
140
+ }
136
141
  }
137
142
 
138
143
  export {
package/cli/open-file.js CHANGED
@@ -11,7 +11,7 @@
11
11
  import {spawn} from 'child_process';
12
12
  import path from 'path';
13
13
 
14
- import log from 'lighthouse-logger';
14
+ import log from '../core/lib/lighthouse-logger.js';
15
15
 
16
16
  /**
17
17
  * Opens a file with its default application, without waiting for it. Failures are logged, not
package/cli/printer.js CHANGED
@@ -8,7 +8,7 @@ import fs from 'fs';
8
8
  import path from 'path';
9
9
  import {setTimeout} from 'timers/promises';
10
10
 
11
- import log from 'lighthouse-logger';
11
+ import log from '../core/lib/lighthouse-logger.js';
12
12
 
13
13
  /**
14
14
  * An enumeration of acceptable output modes:
package/cli/run.js CHANGED
@@ -12,14 +12,15 @@ import os from 'os';
12
12
 
13
13
  import * as ChromeLauncher from 'chrome-launcher';
14
14
  import yargsParser from 'yargs-parser';
15
- import log from 'lighthouse-logger';
16
15
 
16
+ import log from '../core/lib/lighthouse-logger.js';
17
17
  import * as Printer from './printer.js';
18
18
  import {openFile} from './open-file.js';
19
19
  import lighthouse from '../core/index.js';
20
20
  import {getLhrFilenamePrefix} from '../report/generator/file-namer.js';
21
21
  import * as assetSaver from '../core/lib/asset-saver.js';
22
22
  import UrlUtils from '../core/lib/url-utils.js';
23
+ import {Sentry} from '../core/lib/sentry.js';
23
24
 
24
25
  /** @typedef {Error & {code: string, friendlyMessage?: string}} ExitError */
25
26
 
@@ -196,9 +197,10 @@ async function saveResults(runnerResult, flags) {
196
197
  */
197
198
  async function runLighthouse(urlOrUrls, flags, config) {
198
199
  /** @param {any} reason */
199
- function handleTheUnhandled(reason) {
200
+ async function handleTheUnhandled(reason) {
200
201
  process.stderr.write(`Unhandled Rejection. Reason: ${reason}\n`);
201
202
  launchedChrome?.kill();
203
+ await Sentry.captureException(reason, {level: 'fatal'});
202
204
  process.exit(1);
203
205
  }
204
206
  process.on('unhandledRejection', handleTheUnhandled);
@@ -6,7 +6,8 @@
6
6
 
7
7
  import Configstore from 'configstore';
8
8
  import Confirm from 'enquirer';
9
- import log from 'lighthouse-logger';
9
+
10
+ import log from '../core/lib/lighthouse-logger.js';
10
11
 
11
12
  const MAXIMUM_WAIT_TIME = 20 * 1000;
12
13
 
@@ -16,8 +16,8 @@ import url from 'url';
16
16
 
17
17
  import yargs from 'yargs';
18
18
  import * as yargsHelpers from 'yargs/helpers';
19
- import log from 'lighthouse-logger';
20
19
 
20
+ import log from '../../../../core/lib/lighthouse-logger.js';
21
21
  import {runSmokehouse, getShardedDefinitions, DEFAULT_RETRIES, DEFAULT_CONCURRENT_RUNS} from '../smokehouse.js';
22
22
  import {updateTestDefnFormat} from './back-compat-util.js';
23
23
  import {LH_ROOT} from '../../../../shared/root.js';
@@ -14,8 +14,7 @@
14
14
  import {promises as fs} from 'fs';
15
15
  import {spawn} from 'child_process';
16
16
 
17
- import log from 'lighthouse-logger';
18
-
17
+ import log from '../../../../core/lib/lighthouse-logger.js';
19
18
  import * as assetSaver from '../../../../core/lib/asset-saver.js';
20
19
  import {LocalConsole} from '../lib/local-console.js';
21
20
  import {ChildProcessError} from '../lib/child-process-error.js';
@@ -9,8 +9,7 @@
9
9
  * against the results actually collected from Lighthouse.
10
10
  */
11
11
 
12
- import log from 'lighthouse-logger';
13
-
12
+ import log from '../../../core/lib/lighthouse-logger.js';
14
13
  import {LocalConsole} from './lib/local-console.js';
15
14
  import {chromiumVersionCheck} from './version-check.js';
16
15
 
@@ -29,8 +29,7 @@
29
29
 
30
30
  import assert from 'assert/strict';
31
31
 
32
- import log from 'lighthouse-logger';
33
-
32
+ import log from '../../../core/lib/lighthouse-logger.js';
34
33
  import {runLighthouse as cliLighthouseRunner} from './lighthouse-runners/cli.js';
35
34
  import {getAssertionReport} from './report-assert.js';
36
35
  import {LocalConsole} from './lib/local-console.js';
@@ -11,8 +11,7 @@
11
11
  */
12
12
 
13
13
 
14
- import log from 'lighthouse-logger';
15
-
14
+ import log from '../lib/lighthouse-logger.js';
16
15
  import {Audit} from './audit.js';
17
16
  import * as i18n from '../lib/i18n/i18n.js';
18
17
 
@@ -4,8 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import log from 'lighthouse-logger';
8
-
7
+ import log from '../lib/lighthouse-logger.js';
9
8
  import {Audit} from './audit.js';
10
9
  import {taskGroups} from '../lib/tracehouse/task-groups.js';
11
10
  import * as i18n from '../lib/i18n/i18n.js';
@@ -9,8 +9,7 @@
9
9
  * This is done by collecting Chrome console log messages and filtering out the non-error ones.
10
10
  */
11
11
 
12
- import log from 'lighthouse-logger';
13
-
12
+ import log from '../lib/lighthouse-logger.js';
14
13
  import {Audit} from './audit.js';
15
14
  import {JSBundles} from '../computed/js-bundles.js';
16
15
  import * as i18n from '../lib/i18n/i18n.js';
@@ -8,8 +8,7 @@
8
8
  * @fileoverview Audit a page to show a breakdown of execution timings on the main thread
9
9
  */
10
10
 
11
- import log from 'lighthouse-logger';
12
-
11
+ import log from '../lib/lighthouse-logger.js';
13
12
  import {Audit} from './audit.js';
14
13
  import {taskGroups} from '../lib/tracehouse/task-groups.js';
15
14
  import * as i18n from '../lib/i18n/i18n.js';
@@ -1,11 +1,11 @@
1
1
  export default Metrics;
2
2
  declare class Metrics extends Audit {
3
3
  /**
4
- * @param {LH.Artifacts} artifacts
4
+ * @param {Pick<LH.Artifacts, 'GatherContext'|'Trace'|'DevtoolsLog'|'URL'|'SourceMaps'|'HostDPR'>} artifacts
5
5
  * @param {LH.Audit.Context} context
6
6
  * @return {Promise<LH.Audit.Product>}
7
7
  */
8
- static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
8
+ static audit(artifacts: Pick<LH.Artifacts, "GatherContext" | "Trace" | "DevtoolsLog" | "URL" | "SourceMaps" | "HostDPR">, context: LH.Audit.Context): Promise<LH.Audit.Product>;
9
9
  }
10
10
  import { Audit } from './audit.js';
11
11
  //# sourceMappingURL=metrics.d.ts.map
@@ -31,7 +31,7 @@ class Metrics extends Audit {
31
31
  }
32
32
 
33
33
  /**
34
- * @param {LH.Artifacts} artifacts
34
+ * @param {Pick<LH.Artifacts, 'GatherContext'|'Trace'|'DevtoolsLog'|'URL'|'SourceMaps'|'HostDPR'>} artifacts
35
35
  * @param {LH.Audit.Context} context
36
36
  * @return {Promise<LH.Audit.Product>}
37
37
  */
@@ -4,8 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import log from 'lighthouse-logger';
8
-
7
+ import log from '../lib/lighthouse-logger.js';
9
8
  import {ArbitraryEqualityMap} from '../lib/arbitrary-equality-map.js';
10
9
  import {isUnderTest} from '../lib/lh-env.js';
11
10
 
@@ -2,7 +2,7 @@ export { EntityClassificationComputed as EntityClassification };
2
2
  export type EntityCache = Map<string, LH.Artifacts.Entity>;
3
3
  declare const EntityClassificationComputed: typeof EntityClassification & {
4
4
  request: (dependencies: {
5
- URL: LH.Artifacts["URL"];
5
+ URL: Partial<LH.Artifacts["URL"]>;
6
6
  devtoolsLog: LH.DevtoolsLog;
7
7
  }, context: LH.Artifacts.ComputedContext) => Promise<import("../index.js").Artifacts.EntityClassification>;
8
8
  };
@@ -28,12 +28,12 @@ declare class EntityClassification {
28
28
  */
29
29
  static _preloadChromeExtensionsToCache(entityCache: EntityCache, devtoolsLog: LH.DevtoolsLog): void;
30
30
  /**
31
- * @param {{URL: LH.Artifacts['URL'], devtoolsLog: LH.DevtoolsLog}} data
31
+ * @param {{URL: Partial<LH.Artifacts['URL']>, devtoolsLog: LH.DevtoolsLog}} data
32
32
  * @param {LH.Artifacts.ComputedContext} context
33
33
  * @return {Promise<LH.Artifacts.EntityClassification>}
34
34
  */
35
35
  static compute_(data: {
36
- URL: LH.Artifacts["URL"];
36
+ URL: Partial<LH.Artifacts["URL"]>;
37
37
  devtoolsLog: LH.DevtoolsLog;
38
38
  }, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.EntityClassification>;
39
39
  }
@@ -97,7 +97,7 @@ class EntityClassification {
97
97
  }
98
98
 
99
99
  /**
100
- * @param {{URL: LH.Artifacts['URL'], devtoolsLog: LH.DevtoolsLog}} data
100
+ * @param {{URL: Partial<LH.Artifacts['URL']>, devtoolsLog: LH.DevtoolsLog}} data
101
101
  * @param {LH.Artifacts.ComputedContext} context
102
102
  * @return {Promise<LH.Artifacts.EntityClassification>}
103
103
  */
@@ -130,8 +130,10 @@ class EntityClassification {
130
130
  // `mainDocumentUrl` (for navigations), and falls back to `finalDisplayedUrl` (for timespan/snapshot).
131
131
  // See https://github.com/GoogleChrome/lighthouse/issues/13706
132
132
  const firstPartyUrl = data.URL.mainDocumentUrl || data.URL.finalDisplayedUrl;
133
- const firstParty = thirdPartyWeb.getEntity(firstPartyUrl) ||
134
- EntityClassification._makeUpAnEntity(madeUpEntityCache, firstPartyUrl);
133
+ const firstParty = firstPartyUrl ?
134
+ (thirdPartyWeb.getEntity(firstPartyUrl) ||
135
+ EntityClassification._makeUpAnEntity(madeUpEntityCache, firstPartyUrl)) :
136
+ undefined;
135
137
 
136
138
  /**
137
139
  * Convenience function to check if a URL belongs to first party.
@@ -4,8 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import log from 'lighthouse-logger';
8
-
7
+ import log from '../lib/lighthouse-logger.js';
9
8
  import {makeComputedArtifact} from './computed-artifact.js';
10
9
  import SDK from '../lib/cdt/SDK.js';
11
10
 
@@ -2,18 +2,20 @@ export { LoadSimulatorComputed as LoadSimulator };
2
2
  declare const LoadSimulatorComputed: typeof LoadSimulator & {
3
3
  request: (dependencies: {
4
4
  devtoolsLog: LH.DevtoolsLog;
5
- settings: LH.Audit.Context["settings"];
5
+ settings: import("../index.js").Util.ImmutableObject<Pick<import("../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
6
+ throttling?: Partial<import("../index.js").Config.Settings["throttling"]>;
7
+ }>;
6
8
  }, context: LH.Artifacts.ComputedContext) => Promise<import("../../types.js").Gatherer.Simulation.Simulator>;
7
9
  };
8
10
  declare class LoadSimulator {
9
11
  /**
10
- * @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.Audit.Context['settings']}} data
12
+ * @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.Artifacts.ComputedSettings}} data
11
13
  * @param {LH.Artifacts.ComputedContext} context
12
14
  * @return {Promise<LH.Gatherer.Simulation.Simulator>}
13
15
  */
14
16
  static compute_(data: {
15
17
  devtoolsLog: LH.DevtoolsLog;
16
- settings: LH.Audit.Context["settings"];
18
+ settings: LH.Artifacts.ComputedSettings;
17
19
  }, context: LH.Artifacts.ComputedContext): Promise<LH.Gatherer.Simulation.Simulator>;
18
20
  /**
19
21
  * @param {LH.Artifacts.NetworkAnalysis} networkAnalysis
@@ -10,13 +10,20 @@ import {NetworkAnalysis} from './network-analysis.js';
10
10
 
11
11
  class LoadSimulator {
12
12
  /**
13
- * @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.Audit.Context['settings']}} data
13
+ * @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.Artifacts.ComputedSettings}} data
14
14
  * @param {LH.Artifacts.ComputedContext} context
15
15
  * @return {Promise<LH.Gatherer.Simulation.Simulator>}
16
16
  */
17
17
  static async compute_(data, context) {
18
18
  const networkAnalysis = await NetworkAnalysis.request(data.devtoolsLog, context);
19
- return Lantern.Simulation.Simulator.createSimulator({...data.settings, networkAnalysis});
19
+ const throttling = data.settings.throttling ?
20
+ {...Lantern.Simulation.Constants.throttling.mobileSlow4G, ...data.settings.throttling} :
21
+ undefined;
22
+ return Lantern.Simulation.Simulator.createSimulator({
23
+ ...data.settings,
24
+ throttling,
25
+ networkAnalysis,
26
+ });
20
27
  }
21
28
 
22
29
  /**
@@ -41,7 +41,9 @@ export type EventTimingEvent = LH.Trace.AsyncEvent & {
41
41
  declare const ResponsivenessComputed: typeof Responsiveness & {
42
42
  request: (dependencies: {
43
43
  trace: LH.Trace;
44
- settings: LH.Audit.Context["settings"];
44
+ settings: import("../../index.js").Util.ImmutableObject<Pick<import("../../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
45
+ throttling?: Partial<import("../../index.js").Config.Settings["throttling"]>;
46
+ }>;
45
47
  }, context: LH.Artifacts.ComputedContext) => Promise<EventTimingEvent | null>;
46
48
  };
47
49
  declare class Responsiveness {
@@ -64,13 +66,13 @@ declare class Responsiveness {
64
66
  */
65
67
  static findInteractionEvent(responsivenessEvent: ResponsivenessEvent, { traceEvents }: LH.Trace): EventTimingEvent;
66
68
  /**
67
- * @param {{trace: LH.Trace, settings: LH.Audit.Context['settings']}} data
69
+ * @param {{trace: LH.Trace, settings: LH.Artifacts.ComputedSettings}} data
68
70
  * @param {LH.Artifacts.ComputedContext} context
69
71
  * @return {Promise<EventTimingEvent|null>}
70
72
  */
71
73
  static compute_(data: {
72
74
  trace: LH.Trace;
73
- settings: LH.Audit.Context["settings"];
75
+ settings: LH.Artifacts.ComputedSettings;
74
76
  }, context: LH.Artifacts.ComputedContext): Promise<EventTimingEvent | null>;
75
77
  }
76
78
  //# sourceMappingURL=responsiveness.d.ts.map
@@ -130,7 +130,7 @@ class Responsiveness {
130
130
  }
131
131
 
132
132
  /**
133
- * @param {{trace: LH.Trace, settings: LH.Audit.Context['settings']}} data
133
+ * @param {{trace: LH.Trace, settings: LH.Artifacts.ComputedSettings}} data
134
134
  * @param {LH.Artifacts.ComputedContext} context
135
135
  * @return {Promise<EventTimingEvent|null>}
136
136
  */
@@ -7,6 +7,7 @@
7
7
  import {calculateDocFirstByteTs} from '@paulirish/trace_engine/models/trace/insights/Common.js';
8
8
 
9
9
  import {Helpers} from '../../lib/trace-engine.js';
10
+ import {throttling} from '../../config/constants.js';
10
11
  import {makeComputedArtifact} from '../computed-artifact.js';
11
12
  import {NavigationMetric} from './navigation-metric.js';
12
13
  import {MainResource} from '../main-resource.js';
@@ -34,7 +35,8 @@ class TimeToFirstByte extends NavigationMetric {
34
35
  let roundTrips = 2;
35
36
  if (!mainResource.protocol.startsWith('h3')) roundTrips += 1; // TCP
36
37
  if (mainResource.parsedURL.scheme === 'https') roundTrips += 1;
37
- const estimatedTTFB = data.settings.throttling.rttMs * roundTrips + observedResponseTime;
38
+ const rttMs = data.settings.throttling?.rttMs ?? throttling.mobileSlow4G.rttMs;
39
+ const estimatedTTFB = rttMs * roundTrips + observedResponseTime;
38
40
 
39
41
  const timing = Math.max(observedTTFB, estimatedTTFB);
40
42
  return {timing};
@@ -4,7 +4,9 @@ declare const TimingSummaryComputed: typeof TimingSummary & {
4
4
  trace: LH.Trace;
5
5
  devtoolsLog: LH.DevtoolsLog;
6
6
  gatherContext: LH.Artifacts["GatherContext"];
7
- settings: LH.Util.ImmutableObject<LH.Config.Settings>;
7
+ settings: import("../../index.js").Util.ImmutableObject<Pick<import("../../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
8
+ throttling?: Partial<import("../../index.js").Config.Settings["throttling"]>;
9
+ }>;
8
10
  URL: LH.Artifacts["URL"];
9
11
  SourceMaps: LH.Artifacts["SourceMaps"];
10
12
  HostDPR: LH.Artifacts["HostDPR"];
@@ -18,19 +20,19 @@ declare class TimingSummary {
18
20
  * @param {LH.Trace} trace
19
21
  * @param {LH.DevtoolsLog} devtoolsLog
20
22
  * @param {LH.Artifacts['GatherContext']} gatherContext
21
- * @param {LH.Util.ImmutableObject<LH.Config.Settings>} settings
23
+ * @param {LH.Artifacts.ComputedSettings} settings
22
24
  * @param {LH.Artifacts['URL']} URL
23
25
  * @param {LH.Artifacts['SourceMaps']} SourceMaps
24
26
  * @param {LH.Artifacts['HostDPR']} HostDPR
25
27
  * @param {LH.Artifacts.ComputedContext} context
26
28
  * @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
27
29
  */
28
- static summarize(trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts["GatherContext"], settings: LH.Util.ImmutableObject<LH.Config.Settings>, URL: LH.Artifacts["URL"], SourceMaps: LH.Artifacts["SourceMaps"], HostDPR: LH.Artifacts["HostDPR"], context: LH.Artifacts.ComputedContext): Promise<{
30
+ static summarize(trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts["GatherContext"], settings: LH.Artifacts.ComputedSettings, URL: LH.Artifacts["URL"], SourceMaps: LH.Artifacts["SourceMaps"], HostDPR: LH.Artifacts["HostDPR"], context: LH.Artifacts.ComputedContext): Promise<{
29
31
  metrics: LH.Artifacts.TimingSummary;
30
32
  debugInfo: Record<string, boolean>;
31
33
  }>;
32
34
  /**
33
- * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: LH.Util.ImmutableObject<LH.Config.Settings>, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
35
+ * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: LH.Artifacts.ComputedSettings, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
34
36
  * @param {LH.Artifacts.ComputedContext} context
35
37
  * @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
36
38
  */
@@ -38,7 +40,7 @@ declare class TimingSummary {
38
40
  trace: LH.Trace;
39
41
  devtoolsLog: LH.DevtoolsLog;
40
42
  gatherContext: LH.Artifacts["GatherContext"];
41
- settings: LH.Util.ImmutableObject<LH.Config.Settings>;
43
+ settings: LH.Artifacts.ComputedSettings;
42
44
  URL: LH.Artifacts["URL"];
43
45
  SourceMaps: LH.Artifacts["SourceMaps"];
44
46
  HostDPR: LH.Artifacts["HostDPR"];
@@ -4,8 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import log from 'lighthouse-logger';
8
-
7
+ import log from '../../lib/lighthouse-logger.js';
9
8
  import {ProcessedTrace} from '../processed-trace.js';
10
9
  import {ProcessedNavigation} from '../processed-navigation.js';
11
10
  import {Speedline} from '../speedline.js';
@@ -28,7 +27,7 @@ class TimingSummary {
28
27
  * @param {LH.Trace} trace
29
28
  * @param {LH.DevtoolsLog} devtoolsLog
30
29
  * @param {LH.Artifacts['GatherContext']} gatherContext
31
- * @param {LH.Util.ImmutableObject<LH.Config.Settings>} settings
30
+ * @param {LH.Artifacts.ComputedSettings} settings
32
31
  * @param {LH.Artifacts['URL']} URL
33
32
  * @param {LH.Artifacts['SourceMaps']} SourceMaps
34
33
  * @param {LH.Artifacts['HostDPR']} HostDPR
@@ -149,7 +148,7 @@ class TimingSummary {
149
148
  return {metrics, debugInfo};
150
149
  }
151
150
  /**
152
- * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: LH.Util.ImmutableObject<LH.Config.Settings>, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
151
+ * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: LH.Artifacts.ComputedSettings, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
153
152
  * @param {LH.Artifacts.ComputedContext} context
154
153
  * @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
155
154
  */
@@ -2,7 +2,9 @@ export { NavigationInsightsComputed as NavigationInsights };
2
2
  declare const NavigationInsightsComputed: typeof NavigationInsights & {
3
3
  request: (dependencies: {
4
4
  trace: LH.Trace;
5
- settings: LH.Audit.Context["settings"];
5
+ settings: Partial<import("../index.js").Util.ImmutableObject<Pick<import("../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
6
+ throttling?: Partial<import("../index.js").Config.Settings["throttling"]>;
7
+ }>>;
6
8
  SourceMaps: LH.Artifacts["SourceMaps"];
7
9
  HostDPR: LH.Artifacts["HostDPR"];
8
10
  }, context: LH.Artifacts.ComputedContext) => Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").InsightSet>;
@@ -13,12 +15,12 @@ declare const NavigationInsightsComputed: typeof NavigationInsights & {
13
15
  */
14
16
  declare class NavigationInsights {
15
17
  /**
16
- * @param {{trace: LH.Trace, settings: LH.Audit.Context['settings'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
18
+ * @param {{trace: LH.Trace, settings: Partial<LH.Artifacts.ComputedSettings>, SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
17
19
  * @param {LH.Artifacts.ComputedContext} context
18
20
  */
19
21
  static compute_(data: {
20
22
  trace: LH.Trace;
21
- settings: LH.Audit.Context["settings"];
23
+ settings: Partial<LH.Artifacts.ComputedSettings>;
22
24
  SourceMaps: LH.Artifacts["SourceMaps"];
23
25
  HostDPR: LH.Artifacts["HostDPR"];
24
26
  }, context: LH.Artifacts.ComputedContext): Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").InsightSet>;
@@ -15,7 +15,7 @@ import {TraceEngineResult} from './trace-engine-result.js';
15
15
  */
16
16
  class NavigationInsights {
17
17
  /**
18
- * @param {{trace: LH.Trace, settings: LH.Audit.Context['settings'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
18
+ * @param {{trace: LH.Trace, settings: Partial<LH.Artifacts.ComputedSettings>, SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
19
19
  * @param {LH.Artifacts.ComputedContext} context
20
20
  */
21
21
  static async compute_(data, context) {
@@ -4,8 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import log from 'lighthouse-logger';
8
-
7
+ import log from '../lib/lighthouse-logger.js';
9
8
  import * as Lantern from '../lib/lantern/lantern.js';
10
9
  import {makeComputedArtifact} from './computed-artifact.js';
11
10
  import {NetworkRecords} from './network-records.js';
@@ -3,7 +3,9 @@ declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
3
3
  request: (dependencies: {
4
4
  trace: LH.Trace;
5
5
  devtoolsLog: LH.DevtoolsLog;
6
- settings: LH.Audit.Context["settings"];
6
+ settings: Partial<import("../index.js").Util.ImmutableObject<Pick<import("../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
7
+ throttling?: Partial<import("../index.js").Config.Settings["throttling"]>;
8
+ }>>;
7
9
  URL: LH.Artifacts["URL"];
8
10
  SourceMaps: LH.Artifacts["SourceMaps"];
9
11
  HostDPR: LH.Artifacts["HostDPR"];
@@ -12,14 +14,14 @@ declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
12
14
  };
13
15
  declare class PageDependencyGraph {
14
16
  /**
15
- * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, settings: LH.Audit.Context['settings'], URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR'], fromTrace: boolean}} data
17
+ * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, settings: Partial<LH.Artifacts.ComputedSettings>, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR'], fromTrace: boolean}} data
16
18
  * @param {LH.Artifacts.ComputedContext} context
17
19
  * @return {Promise<LH.Gatherer.Simulation.GraphNode>}
18
20
  */
19
21
  static compute_(data: {
20
22
  trace: LH.Trace;
21
23
  devtoolsLog: LH.DevtoolsLog;
22
- settings: LH.Audit.Context["settings"];
24
+ settings: Partial<LH.Artifacts.ComputedSettings>;
23
25
  URL: LH.Artifacts["URL"];
24
26
  SourceMaps: LH.Artifacts["SourceMaps"];
25
27
  HostDPR: LH.Artifacts["HostDPR"];
@@ -13,7 +13,7 @@ import {TraceEngineResult} from './trace-engine-result.js';
13
13
 
14
14
  class PageDependencyGraph {
15
15
  /**
16
- * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, settings: LH.Audit.Context['settings'], URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR'], fromTrace: boolean}} data
16
+ * @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, settings: Partial<LH.Artifacts.ComputedSettings>, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR'], fromTrace: boolean}} data
17
17
  * @param {LH.Artifacts.ComputedContext} context
18
18
  * @return {Promise<LH.Gatherer.Simulation.GraphNode>}
19
19
  */
@@ -2,7 +2,9 @@ export { TraceEngineResultComputed as TraceEngineResult };
2
2
  declare const TraceEngineResultComputed: typeof TraceEngineResult & {
3
3
  request: (dependencies: {
4
4
  trace: LH.Trace;
5
- settings: LH.Audit.Context["settings"];
5
+ settings: Partial<LH.Util.ImmutableObject<Pick<import("../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
6
+ throttling?: Partial<LH.Config.Settings["throttling"]>;
7
+ }>>;
6
8
  SourceMaps: LH.Artifacts["SourceMaps"];
7
9
  HostDPR: LH.Artifacts["HostDPR"];
8
10
  }, context: LH.Artifacts.ComputedContext) => Promise<LH.Artifacts.TraceEngineResult>;
@@ -13,12 +15,12 @@ declare const TraceEngineResultComputed: typeof TraceEngineResult & {
13
15
  declare class TraceEngineResult {
14
16
  /**
15
17
  * @param {LH.TraceEvent[]} _traceEvents
16
- * @param {LH.Audit.Context['settings']} settings
18
+ * @param {Partial<LH.Artifacts.ComputedSettings>} settings
17
19
  * @param {LH.Artifacts['SourceMaps']} SourceMaps
18
20
  * @param {LH.Artifacts['HostDPR']} HostDPR
19
21
  * @return {Promise<LH.Artifacts.TraceEngineResult>}
20
22
  */
21
- static runTraceEngine(_traceEvents: LH.TraceEvent[], settings: LH.Audit.Context["settings"], SourceMaps: LH.Artifacts["SourceMaps"], HostDPR: LH.Artifacts["HostDPR"]): Promise<LH.Artifacts.TraceEngineResult>;
23
+ static runTraceEngine(_traceEvents: LH.TraceEvent[], settings: Partial<LH.Artifacts.ComputedSettings>, SourceMaps: LH.Artifacts["SourceMaps"], HostDPR: LH.Artifacts["HostDPR"]): Promise<LH.Artifacts.TraceEngineResult>;
22
24
  /**
23
25
  * Adapts the given DevTools function that returns a localized string to one
24
26
  * that returns a LH.IcuMessage.
@@ -51,13 +53,13 @@ declare class TraceEngineResult {
51
53
  */
52
54
  static localizeInsights(insightSets: import("@paulirish/trace_engine/models/trace/insights/types.js").TraceInsightSets): void;
53
55
  /**
54
- * @param {{trace: LH.Trace, settings: LH.Audit.Context['settings'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
56
+ * @param {{trace: LH.Trace, settings: Partial<LH.Artifacts.ComputedSettings>, SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
55
57
  * @param {LH.Artifacts.ComputedContext} context
56
58
  * @return {Promise<LH.Artifacts.TraceEngineResult>}
57
59
  */
58
60
  static compute_(data: {
59
61
  trace: LH.Trace;
60
- settings: LH.Audit.Context["settings"];
62
+ settings: Partial<LH.Artifacts.ComputedSettings>;
61
63
  SourceMaps: LH.Artifacts["SourceMaps"];
62
64
  HostDPR: LH.Artifacts["HostDPR"];
63
65
  }, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.TraceEngineResult>;