lighthouse 9.5.0-dev.20220905 → 9.5.0-dev.20220906

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.
@@ -28,6 +28,7 @@ import NetworkRecords from '../../computed/network-records.js';
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,
@@ -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,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "9.5.0-dev.20220905",
4
+ "version": "9.5.0-dev.20220906",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {
@@ -52,6 +52,8 @@ declare module Gatherer {
52
52
  gatherMode: GatherMode;
53
53
  /** The connection to the page being analyzed. */
54
54
  driver: FRTransitionalDriver;
55
+ /** The Puppeteer page handle. Will be undefined in legacy navigation mode. */
56
+ page?: LH.Puppeteer.Page;
55
57
  /** The set of base artifacts that are always collected. */
56
58
  baseArtifacts: FRBaseArtifacts;
57
59
  /** The cached results of computed artifacts. */