lighthouse 10.4.0-dev.20230712 → 10.4.0-dev.20230714

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 (174) hide show
  1. package/cli/cli-flags.d.ts +1 -6
  2. package/cli/cli-flags.js +0 -5
  3. package/cli/run.js +3 -10
  4. package/cli/test/smokehouse/lighthouse-runners/bundle.js +3 -1
  5. package/core/config/config-helpers.d.ts +3 -3
  6. package/core/config/config-helpers.js +5 -12
  7. package/core/config/config.js +1 -7
  8. package/core/config/constants.d.ts +0 -2
  9. package/core/config/constants.js +0 -16
  10. package/core/config/filters.js +1 -1
  11. package/core/config/validation.d.ts +5 -10
  12. package/core/config/validation.js +12 -22
  13. package/core/gather/base-artifacts.d.ts +4 -4
  14. package/core/gather/base-artifacts.js +2 -6
  15. package/core/gather/base-gatherer.d.ts +12 -37
  16. package/core/gather/base-gatherer.js +7 -54
  17. package/core/gather/driver/dom.d.ts +4 -4
  18. package/core/gather/driver/dom.js +2 -2
  19. package/core/gather/driver/environment.d.ts +4 -4
  20. package/core/gather/driver/environment.js +2 -2
  21. package/core/gather/driver/execution-context.d.ts +12 -3
  22. package/core/gather/driver/execution-context.js +27 -3
  23. package/core/gather/driver/navigation.d.ts +2 -2
  24. package/core/gather/driver/navigation.js +1 -1
  25. package/core/gather/driver/network-monitor.d.ts +6 -6
  26. package/core/gather/driver/network-monitor.js +3 -3
  27. package/core/gather/driver/network.d.ts +2 -2
  28. package/core/gather/driver/network.js +1 -1
  29. package/core/gather/driver/prepare.d.ts +10 -10
  30. package/core/gather/driver/prepare.js +10 -10
  31. package/core/gather/driver/service-workers.d.ts +4 -4
  32. package/core/gather/driver/service-workers.js +2 -2
  33. package/core/gather/driver/storage.d.ts +6 -6
  34. package/core/gather/driver/storage.js +3 -3
  35. package/core/gather/driver/target-manager.d.ts +6 -5
  36. package/core/gather/driver/target-manager.js +3 -3
  37. package/core/gather/driver/wait-for-condition.d.ts +14 -14
  38. package/core/gather/driver/wait-for-condition.js +8 -8
  39. package/core/gather/driver.d.ts +4 -4
  40. package/core/gather/driver.js +3 -3
  41. package/core/gather/fetcher.d.ts +3 -3
  42. package/core/gather/fetcher.js +1 -1
  43. package/core/gather/gatherers/accessibility.d.ts +4 -4
  44. package/core/gather/gatherers/accessibility.js +3 -3
  45. package/core/gather/gatherers/anchor-elements.d.ts +4 -4
  46. package/core/gather/gatherers/anchor-elements.js +4 -4
  47. package/core/gather/gatherers/bf-cache-failures.d.ts +8 -14
  48. package/core/gather/gatherers/bf-cache-failures.js +5 -14
  49. package/core/gather/gatherers/cache-contents.d.ts +4 -4
  50. package/core/gather/gatherers/cache-contents.js +3 -3
  51. package/core/gather/gatherers/console-messages.d.ts +6 -6
  52. package/core/gather/gatherers/console-messages.js +4 -4
  53. package/core/gather/gatherers/css-usage.d.ts +14 -14
  54. package/core/gather/gatherers/css-usage.js +9 -9
  55. package/core/gather/gatherers/devtools-log-compat.d.ts +5 -5
  56. package/core/gather/gatherers/devtools-log-compat.js +4 -4
  57. package/core/gather/gatherers/devtools-log.d.ts +6 -6
  58. package/core/gather/gatherers/devtools-log.js +4 -4
  59. package/core/gather/gatherers/dobetterweb/doctype.d.ts +4 -4
  60. package/core/gather/gatherers/dobetterweb/doctype.js +3 -3
  61. package/core/gather/gatherers/dobetterweb/domstats.d.ts +4 -4
  62. package/core/gather/gatherers/dobetterweb/domstats.js +3 -3
  63. package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +10 -22
  64. package/core/gather/gatherers/dobetterweb/optimized-images.js +10 -27
  65. package/core/gather/gatherers/dobetterweb/response-compression.d.ts +6 -12
  66. package/core/gather/gatherers/dobetterweb/response-compression.js +6 -15
  67. package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +8 -14
  68. package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +5 -14
  69. package/core/gather/gatherers/full-page-screenshot.d.ts +10 -10
  70. package/core/gather/gatherers/full-page-screenshot.js +6 -6
  71. package/core/gather/gatherers/global-listeners.d.ts +4 -4
  72. package/core/gather/gatherers/global-listeners.js +3 -3
  73. package/core/gather/gatherers/iframe-elements.d.ts +4 -4
  74. package/core/gather/gatherers/iframe-elements.js +3 -3
  75. package/core/gather/gatherers/image-elements.d.ts +10 -10
  76. package/core/gather/gatherers/image-elements.js +6 -6
  77. package/core/gather/gatherers/inputs.d.ts +4 -4
  78. package/core/gather/gatherers/inputs.js +3 -3
  79. package/core/gather/gatherers/inspector-issues.d.ts +8 -19
  80. package/core/gather/gatherers/inspector-issues.js +9 -26
  81. package/core/gather/gatherers/installability-errors.d.ts +6 -6
  82. package/core/gather/gatherers/installability-errors.js +4 -4
  83. package/core/gather/gatherers/js-usage.d.ts +6 -6
  84. package/core/gather/gatherers/js-usage.js +4 -4
  85. package/core/gather/gatherers/link-elements.d.ts +8 -20
  86. package/core/gather/gatherers/link-elements.js +7 -24
  87. package/core/gather/gatherers/main-document-content.d.ts +4 -16
  88. package/core/gather/gatherers/main-document-content.js +5 -23
  89. package/core/gather/gatherers/meta-elements.d.ts +4 -4
  90. package/core/gather/gatherers/meta-elements.js +3 -3
  91. package/core/gather/gatherers/network-user-agent.d.ts +5 -5
  92. package/core/gather/gatherers/network-user-agent.js +4 -4
  93. package/core/gather/gatherers/script-elements.d.ts +6 -11
  94. package/core/gather/gatherers/script-elements.js +4 -13
  95. package/core/gather/gatherers/scripts.d.ts +6 -6
  96. package/core/gather/gatherers/scripts.js +4 -4
  97. package/core/gather/gatherers/seo/embedded-content.d.ts +4 -4
  98. package/core/gather/gatherers/seo/embedded-content.js +3 -3
  99. package/core/gather/gatherers/seo/font-size.d.ts +6 -6
  100. package/core/gather/gatherers/seo/font-size.js +5 -5
  101. package/core/gather/gatherers/seo/robots-txt.d.ts +4 -4
  102. package/core/gather/gatherers/seo/robots-txt.js +3 -3
  103. package/core/gather/gatherers/seo/tap-targets.d.ts +8 -8
  104. package/core/gather/gatherers/seo/tap-targets.js +5 -5
  105. package/core/gather/gatherers/service-worker.d.ts +4 -10
  106. package/core/gather/gatherers/service-worker.js +3 -15
  107. package/core/gather/gatherers/source-maps.d.ts +12 -12
  108. package/core/gather/gatherers/source-maps.js +7 -7
  109. package/core/gather/gatherers/stacks.d.ts +7 -7
  110. package/core/gather/gatherers/stacks.js +6 -6
  111. package/core/gather/gatherers/trace-compat.d.ts +5 -5
  112. package/core/gather/gatherers/trace-compat.js +4 -4
  113. package/core/gather/gatherers/trace-elements.d.ts +13 -25
  114. package/core/gather/gatherers/trace-elements.js +13 -30
  115. package/core/gather/gatherers/trace.d.ts +8 -8
  116. package/core/gather/gatherers/trace.js +5 -5
  117. package/core/gather/gatherers/viewport-dimensions.d.ts +4 -4
  118. package/core/gather/gatherers/viewport-dimensions.js +3 -3
  119. package/core/gather/gatherers/web-app-manifest.d.ts +8 -8
  120. package/core/gather/gatherers/web-app-manifest.js +5 -5
  121. package/core/gather/navigation-runner.d.ts +9 -9
  122. package/core/gather/navigation-runner.js +6 -6
  123. package/core/gather/runner-helpers.d.ts +3 -3
  124. package/core/gather/runner-helpers.js +12 -4
  125. package/core/gather/session.d.ts +2 -2
  126. package/core/gather/session.js +1 -1
  127. package/core/gather/snapshot-runner.d.ts +2 -2
  128. package/core/gather/snapshot-runner.js +1 -1
  129. package/core/gather/timespan-runner.d.ts +2 -2
  130. package/core/gather/timespan-runner.js +1 -1
  131. package/core/index.cjs +0 -7
  132. package/core/index.d.ts +0 -15
  133. package/core/index.js +2 -40
  134. package/core/lib/asset-saver.js +8 -4
  135. package/core/lib/axe.js +1 -1
  136. package/core/lib/emulation.d.ts +14 -14
  137. package/core/lib/emulation.js +7 -7
  138. package/core/lib/page-functions.d.ts +2 -0
  139. package/core/lib/page-functions.js +10 -0
  140. package/core/lib/sentry.js +9 -2
  141. package/core/runner.d.ts +8 -30
  142. package/core/runner.js +6 -39
  143. package/core/user-flow.d.ts +4 -4
  144. package/core/user-flow.js +2 -2
  145. package/dist/report/bundle.esm.js +2221 -5832
  146. package/dist/report/flow.js +2631 -235
  147. package/dist/report/standalone.js +2586 -234
  148. package/package.json +9 -16
  149. package/third-party/esbuild-plugins-polyfills/LICENSE +3 -0
  150. package/third-party/esbuild-plugins-polyfills/README.md +7 -0
  151. package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.d.ts +9 -0
  152. package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.js +129 -0
  153. package/tsconfig.json +1 -0
  154. package/types/artifacts.d.ts +12 -45
  155. package/types/config.d.ts +10 -52
  156. package/types/externs.d.ts +0 -2
  157. package/types/gatherer.d.ts +20 -45
  158. package/types/lh.d.ts +0 -2
  159. package/core/gather/gatherers/gatherer.d.ts +0 -46
  160. package/core/gather/gatherers/gatherer.js +0 -58
  161. package/core/legacy/config/config.d.ts +0 -107
  162. package/core/legacy/config/config.js +0 -566
  163. package/core/legacy/config/legacy-default-config.d.ts +0 -4
  164. package/core/legacy/config/legacy-default-config.js +0 -87
  165. package/core/legacy/gather/connections/connection.d.ts +0 -77
  166. package/core/legacy/gather/connections/connection.js +0 -196
  167. package/core/legacy/gather/connections/cri.d.ts +0 -27
  168. package/core/legacy/gather/connections/cri.js +0 -162
  169. package/core/legacy/gather/connections/raw.d.ts +0 -20
  170. package/core/legacy/gather/connections/raw.js +0 -57
  171. package/core/legacy/gather/driver.d.ts +0 -216
  172. package/core/legacy/gather/driver.js +0 -480
  173. package/core/legacy/gather/gather-runner.d.ts +0 -166
  174. package/core/legacy/gather/gather-runner.js +0 -590
@@ -2,18 +2,18 @@ export namespace UIStrings {
2
2
  const warningSlowHostCpu: string;
3
3
  }
4
4
  /**
5
- * @param {LH.Gatherer.FRProtocolSession} session
5
+ * @param {LH.Gatherer.ProtocolSession} session
6
6
  * @return {Promise<LH.Crdp.Browser.GetVersionResponse & {milestone: number}>}
7
7
  */
8
- export function getBrowserVersion(session: LH.Gatherer.FRProtocolSession): Promise<import("devtools-protocol").Protocol.Browser.GetVersionResponse & {
8
+ export function getBrowserVersion(session: LH.Gatherer.ProtocolSession): Promise<import("devtools-protocol").Protocol.Browser.GetVersionResponse & {
9
9
  milestone: number;
10
10
  }>;
11
11
  /**
12
12
  * Computes the benchmark index to get a rough estimate of device class.
13
- * @param {LH.Gatherer.FRTransitionalDriver['executionContext']} executionContext
13
+ * @param {LH.Gatherer.Driver['executionContext']} executionContext
14
14
  * @return {Promise<number>}
15
15
  */
16
- export function getBenchmarkIndex(executionContext: LH.Gatherer.FRTransitionalDriver['executionContext']): Promise<number>;
16
+ export function getBenchmarkIndex(executionContext: LH.Gatherer.Driver['executionContext']): Promise<number>;
17
17
  /**
18
18
  * Returns a warning if the host device appeared to be underpowered according to BenchmarkIndex.
19
19
  *
@@ -30,7 +30,7 @@ const SLOW_CPU_BENCHMARK_INDEX_THRESHOLD = 1000;
30
30
  const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
31
31
 
32
32
  /**
33
- * @param {LH.Gatherer.FRProtocolSession} session
33
+ * @param {LH.Gatherer.ProtocolSession} session
34
34
  * @return {Promise<LH.Crdp.Browser.GetVersionResponse & {milestone: number}>}
35
35
  */
36
36
  async function getBrowserVersion(session) {
@@ -45,7 +45,7 @@ async function getBrowserVersion(session) {
45
45
 
46
46
  /**
47
47
  * Computes the benchmark index to get a rough estimate of device class.
48
- * @param {LH.Gatherer.FRTransitionalDriver['executionContext']} executionContext
48
+ * @param {LH.Gatherer.Driver['executionContext']} executionContext
49
49
  * @return {Promise<number>}
50
50
  */
51
51
  async function getBenchmarkIndex(executionContext) {
@@ -11,9 +11,9 @@ export class ExecutionContext {
11
11
  * @return {string}
12
12
  */
13
13
  static serializeArguments(args: unknown[]): string;
14
- /** @param {LH.Gatherer.FRProtocolSession} session */
15
- constructor(session: LH.Gatherer.FRProtocolSession);
16
- _session: LH.Gatherer.FRProtocolSession;
14
+ /** @param {LH.Gatherer.ProtocolSession} session */
15
+ constructor(session: LH.Gatherer.ProtocolSession);
16
+ _session: LH.Gatherer.ProtocolSession;
17
17
  /** @type {number|undefined} */
18
18
  _executionContextId: number | undefined;
19
19
  /**
@@ -47,6 +47,15 @@ export class ExecutionContext {
47
47
  * @return {Promise<*>}
48
48
  */
49
49
  _evaluateInContext(expression: string, contextId: number | undefined): Promise<any>;
50
+ /**
51
+ * Serializes an array of functions or strings.
52
+ *
53
+ * Also makes sure that an esbuild-bundled version of Lighthouse will
54
+ * continue to create working code to be executed within the browser.
55
+ * @param {Array<Function|string>=} deps
56
+ * @return {string}
57
+ */
58
+ _serializeDeps(deps?: Array<Function | string> | undefined): string;
50
59
  /**
51
60
  * Note: Prefer `evaluate` instead.
52
61
  * Evaluate an expression in the context of the current page. If useIsolation is true, the expression
@@ -10,7 +10,7 @@ import * as LH from '../../../types/lh.js';
10
10
  import {pageFunctions} from '../../lib/page-functions.js';
11
11
 
12
12
  class ExecutionContext {
13
- /** @param {LH.Gatherer.FRProtocolSession} session */
13
+ /** @param {LH.Gatherer.ProtocolSession} session */
14
14
  constructor(session) {
15
15
  this._session = session;
16
16
 
@@ -108,6 +108,7 @@ class ExecutionContext {
108
108
  ${ExecutionContext._cachedNativesPreamble};
109
109
  globalThis.__lighthouseExecutionContextUniqueIdentifier =
110
110
  ${uniqueExecutionContextIdentifier};
111
+ ${pageFunctions.esbuildFunctionNameStubString}
111
112
  return new Promise(function (resolve) {
112
113
  return Promise.resolve()
113
114
  .then(_ => ${expression})
@@ -154,6 +155,28 @@ class ExecutionContext {
154
155
  }
155
156
  }
156
157
 
158
+ /**
159
+ * Serializes an array of functions or strings.
160
+ *
161
+ * Also makes sure that an esbuild-bundled version of Lighthouse will
162
+ * continue to create working code to be executed within the browser.
163
+ * @param {Array<Function|string>=} deps
164
+ * @return {string}
165
+ */
166
+ _serializeDeps(deps) {
167
+ deps = [pageFunctions.esbuildFunctionNameStubString, ...deps || []];
168
+ return deps.map(dep => {
169
+ if (typeof dep === 'function') {
170
+ // esbuild will change the actual function name (ie. function actualName() {})
171
+ // always, despite minification settings, but preserve the real name in `actualName.name`
172
+ // (see esbuildFunctionNameStubString).
173
+ return `const ${dep.name} = ${dep}`;
174
+ } else {
175
+ return dep;
176
+ }
177
+ }).join('\n');
178
+ }
179
+
157
180
  /**
158
181
  * Note: Prefer `evaluate` instead.
159
182
  * Evaluate an expression in the context of the current page. If useIsolation is true, the expression
@@ -196,7 +219,8 @@ class ExecutionContext {
196
219
  */
197
220
  evaluate(mainFn, options) {
198
221
  const argsSerialized = ExecutionContext.serializeArguments(options.args);
199
- const depsSerialized = options.deps ? options.deps.join('\n') : '';
222
+ const depsSerialized = this._serializeDeps(options.deps);
223
+
200
224
  const expression = `(() => {
201
225
  ${depsSerialized}
202
226
  return (${mainFn})(${argsSerialized});
@@ -215,7 +239,7 @@ class ExecutionContext {
215
239
  */
216
240
  async evaluateOnNewDocument(mainFn, options) {
217
241
  const argsSerialized = ExecutionContext.serializeArguments(options.args);
218
- const depsSerialized = options.deps ? options.deps.join('\n') : '';
242
+ const depsSerialized = this._serializeDeps(options.deps);
219
243
 
220
244
  const expression = `(() => {
221
245
  ${ExecutionContext._cachedNativesPreamble};
@@ -7,12 +7,12 @@ export type NavigationOptions = {
7
7
  * Typical use of this method involves navigating to a neutral page such as `about:blank` in between
8
8
  * navigations.
9
9
  *
10
- * @param {LH.Gatherer.FRTransitionalDriver} driver
10
+ * @param {LH.Gatherer.Driver} driver
11
11
  * @param {LH.NavigationRequestor} requestor
12
12
  * @param {NavigationOptions} options
13
13
  * @return {Promise<{requestedUrl: string, mainDocumentUrl: string, warnings: Array<LH.IcuMessage>}>}
14
14
  */
15
- export function gotoURL(driver: LH.Gatherer.FRTransitionalDriver, requestor: LH.NavigationRequestor, options: NavigationOptions): Promise<{
15
+ export function gotoURL(driver: LH.Gatherer.Driver, requestor: LH.NavigationRequestor, options: NavigationOptions): Promise<{
16
16
  requestedUrl: string;
17
17
  mainDocumentUrl: string;
18
18
  warnings: Array<LH.IcuMessage>;
@@ -77,7 +77,7 @@ function resolveWaitForFullyLoadedOptions(options) {
77
77
  * Typical use of this method involves navigating to a neutral page such as `about:blank` in between
78
78
  * navigations.
79
79
  *
80
- * @param {LH.Gatherer.FRTransitionalDriver} driver
80
+ * @param {LH.Gatherer.Driver} driver
81
81
  * @param {LH.NavigationRequestor} requestor
82
82
  * @param {NavigationOptions} options
83
83
  * @return {Promise<{requestedUrl: string, mainDocumentUrl: string, warnings: Array<LH.IcuMessage>}>}
@@ -17,16 +17,16 @@ export class NetworkMonitor extends NetworkMonitor_base {
17
17
  start: number;
18
18
  end: number;
19
19
  }>;
20
- /** @param {LH.Gatherer.FRTransitionalDriver['targetManager']} targetManager */
21
- constructor(targetManager: LH.Gatherer.FRTransitionalDriver['targetManager']);
20
+ /** @param {LH.Gatherer.Driver['targetManager']} targetManager */
21
+ constructor(targetManager: LH.Gatherer.Driver['targetManager']);
22
22
  /** @type {NetworkRecorder|undefined} */
23
23
  _networkRecorder: NetworkRecorder | undefined;
24
24
  /** @type {Array<LH.Crdp.Page.Frame>} */
25
25
  _frameNavigations: Array<LH.Crdp.Page.Frame>;
26
- /** @type {LH.Gatherer.FRTransitionalDriver['targetManager']} */
27
- _targetManager: LH.Gatherer.FRTransitionalDriver['targetManager'];
28
- /** @type {LH.Gatherer.FRProtocolSession} */
29
- _session: LH.Gatherer.FRProtocolSession;
26
+ /** @type {LH.Gatherer.Driver['targetManager']} */
27
+ _targetManager: LH.Gatherer.Driver['targetManager'];
28
+ /** @type {LH.Gatherer.ProtocolSession} */
29
+ _session: LH.Gatherer.ProtocolSession;
30
30
  /** @param {LH.Crdp.Page.FrameNavigatedEvent} event */
31
31
  _onFrameNavigated: (event: LH.Crdp.Page.FrameNavigatedEvent) => number;
32
32
  /** @param {LH.Protocol.RawEventMessage} event */
@@ -31,14 +31,14 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
31
31
  _frameNavigations = [];
32
32
 
33
33
  // TODO(FR-COMPAT): switch to real TargetManager when legacy removed.
34
- /** @param {LH.Gatherer.FRTransitionalDriver['targetManager']} targetManager */
34
+ /** @param {LH.Gatherer.Driver['targetManager']} targetManager */
35
35
  constructor(targetManager) {
36
36
  super();
37
37
 
38
- /** @type {LH.Gatherer.FRTransitionalDriver['targetManager']} */
38
+ /** @type {LH.Gatherer.Driver['targetManager']} */
39
39
  this._targetManager = targetManager;
40
40
 
41
- /** @type {LH.Gatherer.FRProtocolSession} */
41
+ /** @type {LH.Gatherer.ProtocolSession} */
42
42
  this._session = targetManager.rootSession();
43
43
 
44
44
  /** @param {LH.Crdp.Page.FrameNavigatedEvent} event */
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Return the body of the response with the given ID. Rejects if getting the
3
3
  * body times out.
4
- * @param {LH.Gatherer.FRProtocolSession} session
4
+ * @param {LH.Gatherer.ProtocolSession} session
5
5
  * @param {string} requestId
6
6
  * @param {number} [timeout]
7
7
  * @return {Promise<string>}
8
8
  */
9
- export function fetchResponseBodyFromCache(session: LH.Gatherer.FRProtocolSession, requestId: string, timeout?: number | undefined): Promise<string>;
9
+ export function fetchResponseBodyFromCache(session: LH.Gatherer.ProtocolSession, requestId: string, timeout?: number | undefined): Promise<string>;
10
10
  //# sourceMappingURL=network.d.ts.map
@@ -9,7 +9,7 @@ import {NetworkRequest} from '../../lib/network-request.js';
9
9
  /**
10
10
  * Return the body of the response with the given ID. Rejects if getting the
11
11
  * body times out.
12
- * @param {LH.Gatherer.FRProtocolSession} session
12
+ * @param {LH.Gatherer.ProtocolSession} session
13
13
  * @param {string} requestId
14
14
  * @param {number} [timeout]
15
15
  * @return {Promise<string>}
@@ -3,42 +3,42 @@
3
3
  *
4
4
  * This method assumes `prepareTargetForNavigationMode` or `prepareTargetForTimespanMode` has already been invoked.
5
5
  *
6
- * @param {LH.Gatherer.FRProtocolSession} session
6
+ * @param {LH.Gatherer.ProtocolSession} session
7
7
  * @param {LH.Config.Settings} settings
8
8
  * @param {{disableThrottling: boolean, blockedUrlPatterns?: string[]}} options
9
9
  */
10
- export function prepareThrottlingAndNetwork(session: LH.Gatherer.FRProtocolSession, settings: LH.Config.Settings, options: {
10
+ export function prepareThrottlingAndNetwork(session: LH.Gatherer.ProtocolSession, settings: LH.Config.Settings, options: {
11
11
  disableThrottling: boolean;
12
12
  blockedUrlPatterns?: string[];
13
13
  }): Promise<void>;
14
14
  /**
15
15
  * Prepares a target to be analyzed in timespan mode by enabling protocol domains, emulation, and throttling.
16
16
  *
17
- * @param {LH.Gatherer.FRTransitionalDriver} driver
17
+ * @param {LH.Gatherer.Driver} driver
18
18
  * @param {LH.Config.Settings} settings
19
19
  */
20
- export function prepareTargetForTimespanMode(driver: LH.Gatherer.FRTransitionalDriver, settings: LH.Config.Settings): Promise<void>;
20
+ export function prepareTargetForTimespanMode(driver: LH.Gatherer.Driver, settings: LH.Config.Settings): Promise<void>;
21
21
  /**
22
22
  * Prepares a target to be analyzed in navigation mode by enabling protocol domains, emulation, and new document
23
23
  * handlers for global APIs or error handling.
24
24
  *
25
25
  * This method should be used in combination with `prepareTargetForIndividualNavigation` before a specific navigation occurs.
26
26
  *
27
- * @param {LH.Gatherer.FRTransitionalDriver} driver
27
+ * @param {LH.Gatherer.Driver} driver
28
28
  * @param {LH.Config.Settings} settings
29
29
  */
30
- export function prepareTargetForNavigationMode(driver: LH.Gatherer.FRTransitionalDriver, settings: LH.Config.Settings): Promise<void>;
30
+ export function prepareTargetForNavigationMode(driver: LH.Gatherer.Driver, settings: LH.Config.Settings): Promise<void>;
31
31
  /**
32
32
  * Prepares a target for a particular navigation by resetting storage and setting network.
33
33
  *
34
34
  * This method assumes `prepareTargetForNavigationMode` has already been invoked.
35
35
  *
36
- * @param {LH.Gatherer.FRProtocolSession} session
36
+ * @param {LH.Gatherer.ProtocolSession} session
37
37
  * @param {LH.Config.Settings} settings
38
38
  * @param {Pick<LH.Config.NavigationDefn, 'disableThrottling'|'disableStorageReset'|'blockedUrlPatterns'> & {requestor: LH.NavigationRequestor}} navigation
39
39
  * @return {Promise<{warnings: Array<LH.IcuMessage>}>}
40
40
  */
41
- export function prepareTargetForIndividualNavigation(session: LH.Gatherer.FRProtocolSession, settings: LH.Config.Settings, navigation: Pick<import("../../../types/config.js").default.NavigationDefn, "blockedUrlPatterns" | "disableStorageReset" | "disableThrottling"> & {
41
+ export function prepareTargetForIndividualNavigation(session: LH.Gatherer.ProtocolSession, settings: LH.Config.Settings, navigation: Pick<import("../../../types/config.js").default.NavigationDefn, "blockedUrlPatterns" | "disableStorageReset" | "disableThrottling"> & {
42
42
  requestor: LH.NavigationRequestor;
43
43
  }): Promise<{
44
44
  warnings: Array<LH.IcuMessage>;
@@ -46,7 +46,7 @@ export function prepareTargetForIndividualNavigation(session: LH.Gatherer.FRProt
46
46
  /**
47
47
  * Enables `Debugger` domain to receive async stacktrace information on network request initiators.
48
48
  * This is critical for tracking attribution of tasks and performance simulation accuracy.
49
- * @param {LH.Gatherer.FRProtocolSession} session
49
+ * @param {LH.Gatherer.ProtocolSession} session
50
50
  */
51
- export function enableAsyncStacks(session: LH.Gatherer.FRProtocolSession): Promise<() => Promise<void>>;
51
+ export function enableAsyncStacks(session: LH.Gatherer.ProtocolSession): Promise<() => Promise<void>>;
52
52
  //# sourceMappingURL=prepare.d.ts.map
@@ -13,7 +13,7 @@ import {pageFunctions} from '../../lib/page-functions.js';
13
13
  /**
14
14
  * Enables `Debugger` domain to receive async stacktrace information on network request initiators.
15
15
  * This is critical for tracking attribution of tasks and performance simulation accuracy.
16
- * @param {LH.Gatherer.FRProtocolSession} session
16
+ * @param {LH.Gatherer.ProtocolSession} session
17
17
  */
18
18
  async function enableAsyncStacks(session) {
19
19
  const enable = async () => {
@@ -54,7 +54,7 @@ async function enableAsyncStacks(session) {
54
54
  /**
55
55
  * Use a RequestIdleCallback shim for tests run with simulated throttling, so that the deadline can be used without
56
56
  * a penalty.
57
- * @param {LH.Gatherer.FRTransitionalDriver} driver
57
+ * @param {LH.Gatherer.Driver} driver
58
58
  * @param {LH.Config.Settings} settings
59
59
  * @return {Promise<void>}
60
60
  */
@@ -67,7 +67,7 @@ async function shimRequestIdleCallbackOnNewDocument(driver, settings) {
67
67
  /**
68
68
  * Dismiss JavaScript dialogs (alert, confirm, prompt), providing a
69
69
  * generic promptText in case the dialog is a prompt.
70
- * @param {LH.Gatherer.FRProtocolSession} session
70
+ * @param {LH.Gatherer.ProtocolSession} session
71
71
  * @return {Promise<void>}
72
72
  */
73
73
  async function dismissJavaScriptDialogs(session) {
@@ -87,7 +87,7 @@ async function dismissJavaScriptDialogs(session) {
87
87
 
88
88
  /**
89
89
  * Reset the storage and warn if any stored data could be affecting the scores.
90
- * @param {LH.Gatherer.FRProtocolSession} session
90
+ * @param {LH.Gatherer.ProtocolSession} session
91
91
  * @param {string} url
92
92
  * @return {Promise<{warnings: Array<LH.IcuMessage>}>}
93
93
  */
@@ -112,7 +112,7 @@ async function resetStorageForUrl(session, url) {
112
112
  *
113
113
  * This method assumes `prepareTargetForNavigationMode` or `prepareTargetForTimespanMode` has already been invoked.
114
114
  *
115
- * @param {LH.Gatherer.FRProtocolSession} session
115
+ * @param {LH.Gatherer.ProtocolSession} session
116
116
  * @param {LH.Config.Settings} settings
117
117
  * @param {{disableThrottling: boolean, blockedUrlPatterns?: string[]}} options
118
118
  */
@@ -141,7 +141,7 @@ async function prepareThrottlingAndNetwork(session, settings, options) {
141
141
  * Prepares a target to be analyzed by setting up device emulation (screen/UA, not throttling) and
142
142
  * async stack traces for network initiators.
143
143
  *
144
- * @param {LH.Gatherer.FRTransitionalDriver} driver
144
+ * @param {LH.Gatherer.Driver} driver
145
145
  * @param {LH.Config.Settings} settings
146
146
  */
147
147
  async function prepareDeviceEmulation(driver, settings) {
@@ -155,7 +155,7 @@ async function prepareDeviceEmulation(driver, settings) {
155
155
  /**
156
156
  * Prepares a target to be analyzed in timespan mode by enabling protocol domains, emulation, and throttling.
157
157
  *
158
- * @param {LH.Gatherer.FRTransitionalDriver} driver
158
+ * @param {LH.Gatherer.Driver} driver
159
159
  * @param {LH.Config.Settings} settings
160
160
  */
161
161
  async function prepareTargetForTimespanMode(driver, settings) {
@@ -176,7 +176,7 @@ async function prepareTargetForTimespanMode(driver, settings) {
176
176
  * Ensure the `Intl.Segmenter` created in `pageFunctions.truncate` is cached by v8 before
177
177
  * recording the trace begins.
178
178
  *
179
- * @param {LH.Gatherer.FRTransitionalDriver} driver
179
+ * @param {LH.Gatherer.Driver} driver
180
180
  */
181
181
  async function warmUpIntlSegmenter(driver) {
182
182
  await driver.executionContext.evaluate(pageFunctions.truncate, {
@@ -190,7 +190,7 @@ async function warmUpIntlSegmenter(driver) {
190
190
  *
191
191
  * This method should be used in combination with `prepareTargetForIndividualNavigation` before a specific navigation occurs.
192
192
  *
193
- * @param {LH.Gatherer.FRTransitionalDriver} driver
193
+ * @param {LH.Gatherer.Driver} driver
194
194
  * @param {LH.Config.Settings} settings
195
195
  */
196
196
  async function prepareTargetForNavigationMode(driver, settings) {
@@ -220,7 +220,7 @@ async function prepareTargetForNavigationMode(driver, settings) {
220
220
  *
221
221
  * This method assumes `prepareTargetForNavigationMode` has already been invoked.
222
222
  *
223
- * @param {LH.Gatherer.FRProtocolSession} session
223
+ * @param {LH.Gatherer.ProtocolSession} session
224
224
  * @param {LH.Config.Settings} settings
225
225
  * @param {Pick<LH.Config.NavigationDefn, 'disableThrottling'|'disableStorageReset'|'blockedUrlPatterns'> & {requestor: LH.NavigationRequestor}} navigation
226
226
  * @return {Promise<{warnings: Array<LH.IcuMessage>}>}
@@ -4,13 +4,13 @@
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
- * @param {LH.Gatherer.FRProtocolSession} session
7
+ * @param {LH.Gatherer.ProtocolSession} session
8
8
  * @return {Promise<LH.Crdp.ServiceWorker.WorkerVersionUpdatedEvent>}
9
9
  */
10
- export function getServiceWorkerVersions(session: LH.Gatherer.FRProtocolSession): Promise<LH.Crdp.ServiceWorker.WorkerVersionUpdatedEvent>;
10
+ export function getServiceWorkerVersions(session: LH.Gatherer.ProtocolSession): Promise<LH.Crdp.ServiceWorker.WorkerVersionUpdatedEvent>;
11
11
  /**
12
- * @param {LH.Gatherer.FRProtocolSession} session
12
+ * @param {LH.Gatherer.ProtocolSession} session
13
13
  * @return {Promise<LH.Crdp.ServiceWorker.WorkerRegistrationUpdatedEvent>}
14
14
  */
15
- export function getServiceWorkerRegistrations(session: LH.Gatherer.FRProtocolSession): Promise<LH.Crdp.ServiceWorker.WorkerRegistrationUpdatedEvent>;
15
+ export function getServiceWorkerRegistrations(session: LH.Gatherer.ProtocolSession): Promise<LH.Crdp.ServiceWorker.WorkerRegistrationUpdatedEvent>;
16
16
  //# sourceMappingURL=service-workers.d.ts.map
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  /**
8
- * @param {LH.Gatherer.FRProtocolSession} session
8
+ * @param {LH.Gatherer.ProtocolSession} session
9
9
  * @return {Promise<LH.Crdp.ServiceWorker.WorkerVersionUpdatedEvent>}
10
10
  */
11
11
  function getServiceWorkerVersions(session) {
@@ -37,7 +37,7 @@ function getServiceWorkerVersions(session) {
37
37
  }
38
38
 
39
39
  /**
40
- * @param {LH.Gatherer.FRProtocolSession} session
40
+ * @param {LH.Gatherer.ProtocolSession} session
41
41
  * @return {Promise<LH.Crdp.ServiceWorker.WorkerRegistrationUpdatedEvent>}
42
42
  */
43
43
  function getServiceWorkerRegistrations(session) {
@@ -1,21 +1,21 @@
1
1
  /**
2
- * @param {LH.Gatherer.FRProtocolSession} session
2
+ * @param {LH.Gatherer.ProtocolSession} session
3
3
  * @param {string} url
4
4
  * @return {Promise<LH.IcuMessage[]>}
5
5
  */
6
- export function clearDataForOrigin(session: LH.Gatherer.FRProtocolSession, url: string): Promise<LH.IcuMessage[]>;
6
+ export function clearDataForOrigin(session: LH.Gatherer.ProtocolSession, url: string): Promise<LH.IcuMessage[]>;
7
7
  /**
8
8
  * Clear the network cache on disk and in memory.
9
- * @param {LH.Gatherer.FRProtocolSession} session
9
+ * @param {LH.Gatherer.ProtocolSession} session
10
10
  * @return {Promise<LH.IcuMessage[]>}
11
11
  */
12
- export function clearBrowserCaches(session: LH.Gatherer.FRProtocolSession): Promise<LH.IcuMessage[]>;
12
+ export function clearBrowserCaches(session: LH.Gatherer.ProtocolSession): Promise<LH.IcuMessage[]>;
13
13
  /**
14
- * @param {LH.Gatherer.FRProtocolSession} session
14
+ * @param {LH.Gatherer.ProtocolSession} session
15
15
  * @param {string} url
16
16
  * @return {Promise<LH.IcuMessage | undefined>}
17
17
  */
18
- export function getImportantStorageWarning(session: LH.Gatherer.FRProtocolSession, url: string): Promise<LH.IcuMessage | undefined>;
18
+ export function getImportantStorageWarning(session: LH.Gatherer.ProtocolSession, url: string): Promise<LH.IcuMessage | undefined>;
19
19
  export namespace UIStrings {
20
20
  const warningData: string;
21
21
  const warningCacheTimeout: string;
@@ -34,7 +34,7 @@ const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
34
34
 
35
35
 
36
36
  /**
37
- * @param {LH.Gatherer.FRProtocolSession} session
37
+ * @param {LH.Gatherer.ProtocolSession} session
38
38
  * @param {string} url
39
39
  * @return {Promise<LH.IcuMessage[]>}
40
40
  */
@@ -82,7 +82,7 @@ async function clearDataForOrigin(session, url) {
82
82
  }
83
83
 
84
84
  /**
85
- * @param {LH.Gatherer.FRProtocolSession} session
85
+ * @param {LH.Gatherer.ProtocolSession} session
86
86
  * @param {string} url
87
87
  * @return {Promise<LH.IcuMessage | undefined>}
88
88
  */
@@ -112,7 +112,7 @@ async function getImportantStorageWarning(session, url) {
112
112
 
113
113
  /**
114
114
  * Clear the network cache on disk and in memory.
115
- * @param {LH.Gatherer.FRProtocolSession} session
115
+ * @param {LH.Gatherer.ProtocolSession} session
116
116
  * @return {Promise<LH.IcuMessage[]>}
117
117
  */
118
118
  async function clearBrowserCaches(session) {
@@ -1,7 +1,7 @@
1
1
  export type TargetWithSession = {
2
2
  target: LH.Crdp.Target.TargetInfo;
3
3
  cdpSession: LH.Puppeteer.CDPSession;
4
- session: LH.Gatherer.FRProtocolSession;
4
+ session: LH.Gatherer.ProtocolSession;
5
5
  protocolListener: (event: unknown) => void;
6
6
  };
7
7
  export type ProtocolEventMap = {
@@ -46,14 +46,14 @@ export class TargetManager extends TargetManager_base {
46
46
  _onExecutionContextsCleared(): void;
47
47
  /**
48
48
  * @param {string} sessionId
49
- * @return {LH.Gatherer.FRProtocolSession}
49
+ * @return {LH.Gatherer.ProtocolSession}
50
50
  */
51
- _findSession(sessionId: string): LH.Gatherer.FRProtocolSession;
51
+ _findSession(sessionId: string): LH.Gatherer.ProtocolSession;
52
52
  /**
53
53
  * Returns the root session.
54
- * @return {LH.Gatherer.FRProtocolSession}
54
+ * @return {LH.Gatherer.ProtocolSession}
55
55
  */
56
- rootSession(): LH.Gatherer.FRProtocolSession;
56
+ rootSession(): LH.Gatherer.ProtocolSession;
57
57
  mainFrameExecutionContexts(): import("devtools-protocol").Protocol.Runtime.ExecutionContextDescription[];
58
58
  /**
59
59
  * Returns a listener for all protocol events from session, and augments the
@@ -71,5 +71,6 @@ export class TargetManager extends TargetManager_base {
71
71
  */
72
72
  disable(): Promise<void>;
73
73
  }
74
+ import { ProtocolSession } from '../session.js';
74
75
  export {};
75
76
  //# sourceMappingURL=target-manager.d.ts.map
@@ -19,7 +19,7 @@ import {ProtocolSession} from '../session.js';
19
19
  * @typedef {{
20
20
  * target: LH.Crdp.Target.TargetInfo,
21
21
  * cdpSession: LH.Puppeteer.CDPSession,
22
- * session: LH.Gatherer.FRProtocolSession,
22
+ * session: LH.Gatherer.ProtocolSession,
23
23
  * protocolListener: (event: unknown) => void,
24
24
  * }} TargetWithSession
25
25
  */
@@ -84,7 +84,7 @@ class TargetManager extends ProtocolEventEmitter {
84
84
 
85
85
  /**
86
86
  * @param {string} sessionId
87
- * @return {LH.Gatherer.FRProtocolSession}
87
+ * @return {LH.Gatherer.ProtocolSession}
88
88
  */
89
89
  _findSession(sessionId) {
90
90
  for (const {session, cdpSession} of this._targetIdToTargets.values()) {
@@ -96,7 +96,7 @@ class TargetManager extends ProtocolEventEmitter {
96
96
 
97
97
  /**
98
98
  * Returns the root session.
99
- * @return {LH.Gatherer.FRProtocolSession}
99
+ * @return {LH.Gatherer.ProtocolSession}
100
100
  */
101
101
  rootSession() {
102
102
  const rootSessionId = this._rootCdpSession.id();
@@ -49,35 +49,35 @@ export function waitForNothing(): {
49
49
  /**
50
50
  * Returns a promise that resolve when a frame has been navigated.
51
51
  * Used for detecting that our about:blank reset has been completed.
52
- * @param {LH.Gatherer.FRProtocolSession} session
52
+ * @param {LH.Gatherer.ProtocolSession} session
53
53
  * @return {CancellableWait<LH.Crdp.Page.FrameNavigatedEvent>}
54
54
  */
55
- export function waitForFrameNavigated(session: LH.Gatherer.FRProtocolSession): CancellableWait<LH.Crdp.Page.FrameNavigatedEvent>;
55
+ export function waitForFrameNavigated(session: LH.Gatherer.ProtocolSession): CancellableWait<LH.Crdp.Page.FrameNavigatedEvent>;
56
56
  /**
57
57
  * Returns a promise that resolve when a frame has a FCP.
58
- * @param {LH.Gatherer.FRProtocolSession} session
58
+ * @param {LH.Gatherer.ProtocolSession} session
59
59
  * @param {number} pauseAfterFcpMs
60
60
  * @param {number} maxWaitForFcpMs
61
61
  * @return {CancellableWait}
62
62
  */
63
- export function waitForFcp(session: LH.Gatherer.FRProtocolSession, pauseAfterFcpMs: number, maxWaitForFcpMs: number): CancellableWait;
63
+ export function waitForFcp(session: LH.Gatherer.ProtocolSession, pauseAfterFcpMs: number, maxWaitForFcpMs: number): CancellableWait;
64
64
  /**
65
65
  * Return a promise that resolves `pauseAfterLoadMs` after the load event
66
66
  * fires and a method to cancel internal listeners and timeout.
67
- * @param {LH.Gatherer.FRProtocolSession} session
67
+ * @param {LH.Gatherer.ProtocolSession} session
68
68
  * @param {number} pauseAfterLoadMs
69
69
  * @return {CancellableWait}
70
70
  */
71
- export function waitForLoadEvent(session: LH.Gatherer.FRProtocolSession, pauseAfterLoadMs: number): CancellableWait;
71
+ export function waitForLoadEvent(session: LH.Gatherer.ProtocolSession, pauseAfterLoadMs: number): CancellableWait;
72
72
  /**
73
73
  * Returns a promise that resolves when the network has been idle (after DCL) for
74
74
  * `networkQuietThresholdMs` ms and a method to cancel internal network listeners/timeout.
75
- * @param {LH.Gatherer.FRProtocolSession} session
75
+ * @param {LH.Gatherer.ProtocolSession} session
76
76
  * @param {NetworkMonitor} networkMonitor
77
77
  * @param {{networkQuietThresholdMs: number, busyEvent: NetworkMonitorEvent, idleEvent: NetworkMonitorEvent, isIdle(recorder: NetworkMonitor): boolean, pretendDCLAlreadyFired?: boolean}} networkQuietOptions
78
78
  * @return {CancellableWait}
79
79
  */
80
- export function waitForNetworkIdle(session: LH.Gatherer.FRProtocolSession, networkMonitor: NetworkMonitor, networkQuietOptions: {
80
+ export function waitForNetworkIdle(session: LH.Gatherer.ProtocolSession, networkMonitor: NetworkMonitor, networkQuietOptions: {
81
81
  networkQuietThresholdMs: number;
82
82
  busyEvent: NetworkMonitorEvent;
83
83
  idleEvent: NetworkMonitorEvent;
@@ -86,11 +86,11 @@ export function waitForNetworkIdle(session: LH.Gatherer.FRProtocolSession, netwo
86
86
  }): CancellableWait;
87
87
  /**
88
88
  * Resolves when there have been no long tasks for at least waitForCPUQuiet ms.
89
- * @param {LH.Gatherer.FRProtocolSession} session
89
+ * @param {LH.Gatherer.ProtocolSession} session
90
90
  * @param {number} waitForCPUQuiet
91
91
  * @return {CancellableWait}
92
92
  */
93
- export function waitForCPUIdle(session: LH.Gatherer.FRProtocolSession, waitForCPUQuiet: number): CancellableWait;
93
+ export function waitForCPUIdle(session: LH.Gatherer.ProtocolSession, waitForCPUQuiet: number): CancellableWait;
94
94
  /**
95
95
  * Returns a promise that resolves when:
96
96
  * - All of the following conditions have been met:
@@ -101,16 +101,16 @@ export function waitForCPUIdle(session: LH.Gatherer.FRProtocolSession, waitForCP
101
101
  * - cpuQuietThresholdMs have passed since the last long task after network-2-quiet.
102
102
  * - maxWaitForLoadedMs milliseconds have passed.
103
103
  * See https://github.com/GoogleChrome/lighthouse/issues/627 for more.
104
- * @param {LH.Gatherer.FRProtocolSession} session
104
+ * @param {LH.Gatherer.ProtocolSession} session
105
105
  * @param {NetworkMonitor} networkMonitor
106
106
  * @param {WaitOptions} options
107
107
  * @return {Promise<{timedOut: boolean}>}
108
108
  */
109
- export function waitForFullyLoaded(session: LH.Gatherer.FRProtocolSession, networkMonitor: NetworkMonitor, options: WaitOptions): Promise<{
109
+ export function waitForFullyLoaded(session: LH.Gatherer.ProtocolSession, networkMonitor: NetworkMonitor, options: WaitOptions): Promise<{
110
110
  timedOut: boolean;
111
111
  }>;
112
112
  /**
113
- * @param {LH.Gatherer.FRTransitionalDriver} driver
113
+ * @param {LH.Gatherer.Driver} driver
114
114
  */
115
- export function waitForUserToContinue(driver: LH.Gatherer.FRTransitionalDriver): Promise<void>;
115
+ export function waitForUserToContinue(driver: LH.Gatherer.Driver): Promise<void>;
116
116
  //# sourceMappingURL=wait-for-condition.d.ts.map