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
@@ -24,7 +24,7 @@ export function getYargsParser(manualArgv?: string | undefined): yargs.Argv<yarg
24
24
  default: boolean;
25
25
  describe: string;
26
26
  };
27
- }>, "port" | "screenEmulation" | "emulatedUserAgent" | "hostname" | "preset" | "save-assets" | "list-all-audits" | "list-locales" | "list-trace-categories" | "debug-navigation" | "legacy-navigation" | "additional-trace-categories" | "config-path" | "chrome-flags" | "form-factor" | "max-wait-for-load" | "enable-error-reporting" | "gather-mode" | "audit-mode" | "only-audits" | "only-categories" | "skip-audits" | "budget-path" | "disable-full-page-screenshot"> & yargs.InferredOptionTypes<{
27
+ }>, "port" | "screenEmulation" | "emulatedUserAgent" | "hostname" | "preset" | "save-assets" | "list-all-audits" | "list-locales" | "list-trace-categories" | "debug-navigation" | "additional-trace-categories" | "config-path" | "chrome-flags" | "form-factor" | "max-wait-for-load" | "enable-error-reporting" | "gather-mode" | "audit-mode" | "only-audits" | "only-categories" | "skip-audits" | "budget-path" | "disable-full-page-screenshot"> & yargs.InferredOptionTypes<{
28
28
  'save-assets': {
29
29
  type: "boolean";
30
30
  default: boolean;
@@ -49,11 +49,6 @@ export function getYargsParser(manualArgv?: string | undefined): yargs.Argv<yarg
49
49
  type: "boolean";
50
50
  describe: string;
51
51
  };
52
- 'legacy-navigation': {
53
- type: "boolean";
54
- default: boolean;
55
- describe: string;
56
- };
57
52
  'additional-trace-categories': {
58
53
  type: "string";
59
54
  describe: string;
package/cli/cli-flags.js CHANGED
@@ -117,11 +117,6 @@ function getYargsParser(manualArgv) {
117
117
  type: 'boolean',
118
118
  describe: 'Pause after page load to wait for permission to continue the run, evaluate `continueLighthouseRun` in the console to continue.',
119
119
  },
120
- 'legacy-navigation': {
121
- type: 'boolean',
122
- default: false,
123
- describe: '[DEPRECATED] Use the legacy navigation runner to gather results. Only use this if you are using a pre-10.0 custom Lighthouse config, or if Lighthouse unexpectedly fails after updating to 10.0. Please file a bug if you need this flag for Lighthouse to work.',
124
- },
125
120
  'additional-trace-categories': {
126
121
  type: 'string',
127
122
  describe: 'Additional categories to capture with the trace (comma-delimited).',
package/cli/run.js CHANGED
@@ -16,7 +16,7 @@ import log from 'lighthouse-logger';
16
16
  import open from 'open';
17
17
 
18
18
  import * as Printer from './printer.js';
19
- import lighthouse, {legacyNavigation} from '../core/index.js';
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';
@@ -238,16 +238,9 @@ async function runLighthouse(url, flags, config) {
238
238
  flags.port = launchedChrome.port;
239
239
  }
240
240
 
241
- if (flags.legacyNavigation) {
242
- log.warn('CLI', 'Legacy navigation CLI is deprecated');
243
- flags.channel = 'legacy-navigation-cli';
244
- } else if (!flags.channel) {
245
- flags.channel = 'cli';
246
- }
241
+ flags.channel = 'cli';
247
242
 
248
- const runnerResult = flags.legacyNavigation ?
249
- await legacyNavigation(url, flags, config) :
250
- await lighthouse(url, flags, config);
243
+ const runnerResult = await lighthouse(url, flags, config);
251
244
 
252
245
  // If in gatherMode only, there will be no runnerResult.
253
246
  if (runnerResult) {
@@ -56,6 +56,7 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
56
56
 
57
57
  const originalBuffer = global.Buffer;
58
58
  const originalRequire = global.require;
59
+ const originalProcess = global.process;
59
60
  if (typeof globalThis === 'undefined') {
60
61
  // @ts-expect-error - exposing for loading of dt-bundle.
61
62
  global.globalThis = global;
@@ -66,6 +67,7 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
66
67
 
67
68
  global.require = originalRequire;
68
69
  global.Buffer = originalBuffer;
70
+ global.process = originalProcess;
69
71
 
70
72
  /** @type {import('../../../../core/index.js')['default']} */
71
73
  // @ts-expect-error - not worth giving test global an actual type.
@@ -122,7 +124,7 @@ async function runLighthouse(url, config, testRunnerOptions = {}) {
122
124
  const log = logs.join('') + '\n';
123
125
 
124
126
  if (workerResponse.type === 'error') {
125
- new Error(`Worker returned an error: ${workerResponse.value}\nLog:\n${log}`);
127
+ throw new Error(`Worker returned an error: ${workerResponse.value}\nLog:\n${log}`);
126
128
  }
127
129
 
128
130
  const result = workerResponse.value;
@@ -1,4 +1,4 @@
1
- export type GathererConstructor = typeof import('../gather/gatherers/gatherer.js').Gatherer;
1
+ export type GathererConstructor = typeof import('../gather/base-gatherer.js').default;
2
2
  export type Audit = typeof import('../audits/audit.js')['Audit'];
3
3
  export type Gatherer = InstanceType<GathererConstructor>;
4
4
  /**
@@ -71,9 +71,9 @@ export function resolveAuditsToDefns(audits: LH.Config['audits'], configDir?: st
71
71
  * @param {LH.Config.GathererJson} gathererJson
72
72
  * @param {Array<string>} coreGathererList
73
73
  * @param {string=} configDir
74
- * @return {Promise<LH.Config.GathererDefn>}
74
+ * @return {Promise<LH.Config.AnyGathererDefn>}
75
75
  */
76
- export function resolveGathererToDefn(gathererJson: LH.Config.GathererJson, coreGathererList: Array<string>, configDir?: string | undefined): Promise<LH.Config.GathererDefn>;
76
+ export function resolveGathererToDefn(gathererJson: LH.Config.GathererJson, coreGathererList: Array<string>, configDir?: string | undefined): Promise<LH.Config.AnyGathererDefn>;
77
77
  /**
78
78
  * Resolves the location of the specified module and returns an absolute
79
79
  * string path to the file. Used for loading custom audits and gatherers.
@@ -20,7 +20,7 @@ import {getModuleDirectory} from '../../esm-utils.js';
20
20
 
21
21
  const require = createRequire(import.meta.url);
22
22
 
23
- /** @typedef {typeof import('../gather/gatherers/gatherer.js').Gatherer} GathererConstructor */
23
+ /** @typedef {typeof import('../gather/base-gatherer.js').default} GathererConstructor */
24
24
  /** @typedef {typeof import('../audits/audit.js')['Audit']} Audit */
25
25
  /** @typedef {InstanceType<GathererConstructor>} Gatherer */
26
26
 
@@ -160,7 +160,7 @@ function mergeConfigFragmentArrayByKey(baseArray, extensionArray, keyFn) {
160
160
  * - {instance: myGathererInstance}
161
161
  *
162
162
  * @param {LH.Config.GathererJson} gatherer
163
- * @return {{instance?: Gatherer, implementation?: GathererConstructor, path?: string}} passes
163
+ * @return {{instance?: Gatherer, implementation?: GathererConstructor, path?: string}}
164
164
  */
165
165
  function expandGathererShorthand(gatherer) {
166
166
  if (typeof gatherer === 'string') {
@@ -178,7 +178,7 @@ function expandGathererShorthand(gatherer) {
178
178
  } else if (typeof gatherer === 'function') {
179
179
  // just GathererConstructor
180
180
  return {implementation: gatherer};
181
- } else if (gatherer && typeof gatherer.beforePass === 'function') {
181
+ } else if (gatherer && typeof gatherer.getArtifact === 'function') {
182
182
  // just GathererInstance
183
183
  return {instance: gatherer};
184
184
  } else {
@@ -254,7 +254,7 @@ async function requireWrapper(requirePath) {
254
254
  * @param {string} gathererPath
255
255
  * @param {Array<string>} coreGathererList
256
256
  * @param {string=} configDir
257
- * @return {Promise<LH.Config.GathererDefn>}
257
+ * @return {Promise<LH.Config.AnyGathererDefn>}
258
258
  */
259
259
  async function requireGatherer(gathererPath, coreGathererList, configDir) {
260
260
  const coreGatherer = coreGathererList.find(a => a === `${gathererPath}.js`);
@@ -399,7 +399,7 @@ async function mergePlugins(config, configDir, flags) {
399
399
  * @param {LH.Config.GathererJson} gathererJson
400
400
  * @param {Array<string>} coreGathererList
401
401
  * @param {string=} configDir
402
- * @return {Promise<LH.Config.GathererDefn>}
402
+ * @return {Promise<LH.Config.AnyGathererDefn>}
403
403
  */
404
404
  async function resolveGathererToDefn(gathererJson, coreGathererList, configDir) {
405
405
  const gathererDefn = expandGathererShorthand(gathererJson);
@@ -595,13 +595,6 @@ function deepCloneConfigJson(json) {
595
595
 
596
596
  // Copy arrays that could contain non-serializable properties to allow for programmatic
597
597
  // injection of audit and gatherer implementations.
598
- if (Array.isArray(cloned.passes) && Array.isArray(json.passes)) {
599
- for (let i = 0; i < cloned.passes.length; i++) {
600
- const pass = cloned.passes[i];
601
- pass.gatherers = (json.passes[i].gatherers || []).map(gatherer => shallowClone(gatherer));
602
- }
603
- }
604
-
605
598
  if (Array.isArray(json.audits)) {
606
599
  cloned.audits = json.audits.map(audit => shallowClone(audit));
607
600
  }
@@ -12,7 +12,6 @@ import {Runner} from '../runner.js';
12
12
  import defaultConfig from './default-config.js';
13
13
  import {defaultNavigationConfig, nonSimulatedPassConfigOverrides} from './constants.js'; // eslint-disable-line max-len
14
14
  import {
15
- isFRGathererDefn,
16
15
  throwInvalidDependencyOrder,
17
16
  isValidArtifactDependency,
18
17
  throwInvalidArtifactDependency,
@@ -104,7 +103,7 @@ function resolveExtensions(config) {
104
103
  * Looks up the required artifact IDs for each dependency, throwing if no earlier artifact satisfies the dependency.
105
104
  *
106
105
  * @param {LH.Config.ArtifactJson} artifact
107
- * @param {LH.Config.AnyFRGathererDefn} gatherer
106
+ * @param {LH.Config.AnyGathererDefn} gatherer
108
107
  * @param {Map<Symbol, LH.Config.AnyArtifactDefn>} artifactDefnsBySymbol
109
108
  * @return {LH.Config.AnyArtifactDefn['dependencies']}
110
109
  */
@@ -154,14 +153,9 @@ async function resolveArtifactsToDefns(artifacts, configDir) {
154
153
  const coreGathererList = Runner.getGathererList();
155
154
  const artifactDefns = [];
156
155
  for (const artifactJson of sortedArtifacts) {
157
- /** @type {LH.Config.GathererJson} */
158
- // @ts-expect-error - remove when legacy runner path is removed.
159
156
  const gathererJson = artifactJson.gatherer;
160
157
 
161
158
  const gatherer = await resolveGathererToDefn(gathererJson, coreGathererList, configDir);
162
- if (!isFRGathererDefn(gatherer)) {
163
- throw new Error(`${gatherer.instance.name} gatherer does not have a Fraggle Rock meta obj`);
164
- }
165
159
 
166
160
  /** @type {LH.Config.AnyArtifactDefn} */
167
161
  // @ts-expect-error - Typescript can't validate the gatherer and dependencies match
@@ -48,8 +48,6 @@ export namespace userAgents {
48
48
  }
49
49
  /** @type {LH.Config.Settings} */
50
50
  export const defaultSettings: LH.Config.Settings;
51
- /** @type {LH.Config.Pass} */
52
- export const defaultPassConfig: LH.Config.Pass;
53
51
  /** @type {Required<LH.Config.NavigationJson>} */
54
52
  export const defaultNavigationConfig: Required<LH.Config.NavigationJson>;
55
53
  export namespace nonSimulatedPassConfigOverrides {
@@ -127,21 +127,6 @@ const defaultSettings = {
127
127
  skipAudits: null,
128
128
  };
129
129
 
130
- /** @type {LH.Config.Pass} */
131
- const defaultPassConfig = {
132
- passName: 'defaultPass',
133
- loadFailureMode: 'fatal',
134
- recordTrace: false,
135
- useThrottling: false,
136
- pauseAfterFcpMs: 0,
137
- pauseAfterLoadMs: 0,
138
- networkQuietThresholdMs: 0,
139
- cpuQuietThresholdMs: 0,
140
- blockedUrlPatterns: [],
141
- blankPage: 'about:blank',
142
- gatherers: [],
143
- };
144
-
145
130
  /** @type {Required<LH.Config.NavigationJson>} */
146
131
  const defaultNavigationConfig = {
147
132
  id: 'default',
@@ -169,7 +154,6 @@ export {
169
154
  screenEmulationMetrics,
170
155
  userAgents,
171
156
  defaultSettings,
172
- defaultPassConfig,
173
157
  defaultNavigationConfig,
174
158
  nonSimulatedPassConfigOverrides,
175
159
  };
@@ -8,7 +8,7 @@ import log from 'lighthouse-logger';
8
8
 
9
9
  import {Audit} from '../audits/audit.js';
10
10
 
11
- /** @type {Record<keyof LH.FRBaseArtifacts, string>} */
11
+ /** @type {Record<keyof LH.BaseArtifacts, string>} */
12
12
  const baseArtifactKeySource = {
13
13
  fetchTime: '',
14
14
  LighthouseRunWarnings: '',
@@ -1,17 +1,12 @@
1
- /**
2
- * @param {LH.Config.GathererDefn | LH.Config.AnyFRGathererDefn} gathererDefn
3
- * @return {gathererDefn is LH.Config.AnyFRGathererDefn}
4
- */
5
- export function isFRGathererDefn(gathererDefn: LH.Config.GathererDefn | LH.Config.AnyFRGathererDefn): gathererDefn is import("../../types/config.js").default.AnyFRGathererDefn;
6
1
  /**
7
2
  * Determines if the artifact dependency direction is valid. The dependency's minimum supported mode
8
3
  * must be less than or equal to the dependent's.
9
4
  *
10
- * @param {LH.Config.AnyFRGathererDefn} dependent The artifact that depends on the other.
11
- * @param {LH.Config.AnyFRGathererDefn} dependency The artifact that is being depended on by the other.
5
+ * @param {LH.Config.AnyGathererDefn} dependent The artifact that depends on the other.
6
+ * @param {LH.Config.AnyGathererDefn} dependency The artifact that is being depended on by the other.
12
7
  * @return {boolean}
13
8
  */
14
- export function isValidArtifactDependency(dependent: LH.Config.AnyFRGathererDefn, dependency: LH.Config.AnyFRGathererDefn): boolean;
9
+ export function isValidArtifactDependency(dependent: LH.Config.AnyGathererDefn, dependency: LH.Config.AnyGathererDefn): boolean;
15
10
  /**
16
11
  * Throws if pluginName is invalid or (somehow) collides with a category in the
17
12
  * config being added to.
@@ -21,9 +16,9 @@ export function isValidArtifactDependency(dependent: LH.Config.AnyFRGathererDefn
21
16
  export function assertValidPluginName(config: LH.Config, pluginName: string): void;
22
17
  /**
23
18
  * Throws an error if the provided object does not implement the required Fraggle Rock gatherer interface.
24
- * @param {LH.Config.AnyFRGathererDefn} gathererDefn
19
+ * @param {LH.Config.AnyArtifactDefn} artifactDefn
25
20
  */
26
- export function assertValidFRGatherer(gathererDefn: LH.Config.AnyFRGathererDefn): void;
21
+ export function assertValidArtifact(artifactDefn: LH.Config.AnyArtifactDefn): void;
27
22
  /**
28
23
  * Throws an error if the provided object does not implement the required navigations interface.
29
24
  * @param {LH.Config.ResolvedConfig['navigations']} navigationsDefn
@@ -5,23 +5,15 @@
5
5
  */
6
6
 
7
7
  import {Audit} from '../audits/audit.js';
8
- import BaseFRGatherer from '../gather/base-gatherer.js';
8
+ import BaseGatherer from '../gather/base-gatherer.js';
9
9
  import * as i18n from '../lib/i18n/i18n.js';
10
10
 
11
- /**
12
- * @param {LH.Config.GathererDefn | LH.Config.AnyFRGathererDefn} gathererDefn
13
- * @return {gathererDefn is LH.Config.AnyFRGathererDefn}
14
- */
15
- function isFRGathererDefn(gathererDefn) {
16
- return 'meta' in gathererDefn.instance;
17
- }
18
-
19
11
  /**
20
12
  * Determines if the artifact dependency direction is valid. The dependency's minimum supported mode
21
13
  * must be less than or equal to the dependent's.
22
14
  *
23
- * @param {LH.Config.AnyFRGathererDefn} dependent The artifact that depends on the other.
24
- * @param {LH.Config.AnyFRGathererDefn} dependency The artifact that is being depended on by the other.
15
+ * @param {LH.Config.AnyGathererDefn} dependent The artifact that depends on the other.
16
+ * @param {LH.Config.AnyGathererDefn} dependency The artifact that is being depended on by the other.
25
17
  * @return {boolean}
26
18
  */
27
19
  function isValidArtifactDependency(dependent, dependency) {
@@ -55,25 +47,24 @@ function assertValidPluginName(config, pluginName) {
55
47
 
56
48
  /**
57
49
  * Throws an error if the provided object does not implement the required Fraggle Rock gatherer interface.
58
- * @param {LH.Config.AnyFRGathererDefn} gathererDefn
50
+ * @param {LH.Config.AnyArtifactDefn} artifactDefn
59
51
  */
60
- function assertValidFRGatherer(gathererDefn) {
61
- const gatherer = gathererDefn.instance;
62
- const gathererName = gatherer.name;
52
+ function assertValidArtifact(artifactDefn) {
53
+ const gatherer = artifactDefn.gatherer.instance;
63
54
 
64
55
  if (typeof gatherer.meta !== 'object') {
65
- throw new Error(`${gathererName} gatherer did not provide a meta object.`);
56
+ throw new Error(`Gatherer for ${artifactDefn.id} did not provide a meta object.`);
66
57
  }
67
58
 
68
59
  if (gatherer.meta.supportedModes.length === 0) {
69
- throw new Error(`${gathererName} gatherer did not support any gather modes.`);
60
+ throw new Error(`Gatherer for ${artifactDefn.id} did not support any gather modes.`);
70
61
  }
71
62
 
72
63
  if (
73
64
  typeof gatherer.getArtifact !== 'function' ||
74
- gatherer.getArtifact === BaseFRGatherer.prototype.getArtifact
65
+ gatherer.getArtifact === BaseGatherer.prototype.getArtifact
75
66
  ) {
76
- throw new Error(`${gathererName} gatherer did not define a "getArtifact" method.`);
67
+ throw new Error(`Gatherer for ${artifactDefn.id} did not define a "getArtifact" method.`);
77
68
  }
78
69
  }
79
70
 
@@ -266,7 +257,7 @@ function assertValidConfig(resolvedConfig) {
266
257
  throw new Error(`Config defined multiple artifacts with id '${artifactDefn.id}'`);
267
258
  }
268
259
  artifactIds.add(artifactDefn.id);
269
- assertValidFRGatherer(artifactDefn.gatherer);
260
+ assertValidArtifact(artifactDefn);
270
261
  }
271
262
 
272
263
  for (const auditDefn of resolvedConfig.audits || []) {
@@ -309,10 +300,9 @@ function throwInvalidArtifactDependency(artifactId, dependencyKey) {
309
300
  }
310
301
 
311
302
  export {
312
- isFRGathererDefn,
313
303
  isValidArtifactDependency,
314
304
  assertValidPluginName,
315
- assertValidFRGatherer,
305
+ assertValidArtifact,
316
306
  assertValidFRNavigations,
317
307
  assertValidAudit,
318
308
  assertValidCategories,
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * @param {LH.Config.ResolvedConfig} resolvedConfig
3
- * @param {LH.Gatherer.FRTransitionalDriver} driver
3
+ * @param {LH.Gatherer.Driver} driver
4
4
  * @param {{gatherMode: LH.Gatherer.GatherMode}} context
5
5
  * @return {Promise<LH.BaseArtifacts>}
6
6
  */
7
- export function getBaseArtifacts(resolvedConfig: LH.Config.ResolvedConfig, driver: LH.Gatherer.FRTransitionalDriver, context: {
7
+ export function getBaseArtifacts(resolvedConfig: LH.Config.ResolvedConfig, driver: LH.Gatherer.Driver, context: {
8
8
  gatherMode: LH.Gatherer.GatherMode;
9
9
  }): Promise<LH.BaseArtifacts>;
10
10
  /**
11
- * @param {LH.FRBaseArtifacts} baseArtifacts
11
+ * @param {LH.BaseArtifacts} baseArtifacts
12
12
  * @param {Partial<LH.Artifacts>} gathererArtifacts
13
13
  * @return {LH.Artifacts}
14
14
  */
15
- export function finalizeArtifacts(baseArtifacts: LH.FRBaseArtifacts, gathererArtifacts: Partial<LH.Artifacts>): LH.Artifacts;
15
+ export function finalizeArtifacts(baseArtifacts: LH.BaseArtifacts, gathererArtifacts: Partial<LH.Artifacts>): LH.Artifacts;
16
16
  //# sourceMappingURL=base-artifacts.d.ts.map
@@ -13,7 +13,7 @@ import {
13
13
 
14
14
  /**
15
15
  * @param {LH.Config.ResolvedConfig} resolvedConfig
16
- * @param {LH.Gatherer.FRTransitionalDriver} driver
16
+ * @param {LH.Gatherer.Driver} driver
17
17
  * @param {{gatherMode: LH.Gatherer.GatherMode}} context
18
18
  * @return {Promise<LH.BaseArtifacts>}
19
19
  */
@@ -38,10 +38,6 @@ async function getBaseArtifacts(resolvedConfig, driver, context) {
38
38
  },
39
39
  PageLoadError: null,
40
40
  GatherContext: context,
41
- // Artifacts that have been replaced by regular gatherers in Fraggle Rock.
42
- NetworkUserAgent: '',
43
- traces: {},
44
- devtoolsLogs: {},
45
41
  };
46
42
  }
47
43
 
@@ -63,7 +59,7 @@ function deduplicateWarnings(warnings) {
63
59
  }
64
60
 
65
61
  /**
66
- * @param {LH.FRBaseArtifacts} baseArtifacts
62
+ * @param {LH.BaseArtifacts} baseArtifacts
67
63
  * @param {Partial<LH.Artifacts>} gathererArtifacts
68
64
  * @return {LH.Artifacts}
69
65
  */
@@ -1,70 +1,45 @@
1
- export default FRGatherer;
1
+ export default BaseGatherer;
2
2
  /**
3
3
  * Base class for all gatherers.
4
4
  *
5
5
  * @implements {LH.Gatherer.GathererInstance}
6
- * @implements {LH.Gatherer.FRGathererInstance}
7
6
  */
8
- declare class FRGatherer implements LH.Gatherer.GathererInstance, LH.Gatherer.FRGathererInstance {
7
+ declare class BaseGatherer implements LH.Gatherer.GathererInstance {
9
8
  /** @type {LH.Gatherer.GathererMeta} */
10
9
  meta: LH.Gatherer.GathererMeta;
11
10
  /**
12
11
  * Method to start observing a page for an arbitrary period of time.
13
- * @param {LH.Gatherer.FRTransitionalContext} passContext
12
+ * @param {LH.Gatherer.Context} passContext
14
13
  * @return {Promise<void>|void}
15
14
  */
16
- startInstrumentation(passContext: LH.Gatherer.FRTransitionalContext): Promise<void> | void;
15
+ startInstrumentation(passContext: LH.Gatherer.Context): Promise<void> | void;
17
16
  /**
18
17
  * Method to start observing a page when the measurements are very sensitive and
19
18
  * should observe as little Lighthouse-induced work as possible.
20
- * @param {LH.Gatherer.FRTransitionalContext} passContext
19
+ * @param {LH.Gatherer.Context} passContext
21
20
  * @return {Promise<void>|void}
22
21
  */
23
- startSensitiveInstrumentation(passContext: LH.Gatherer.FRTransitionalContext): Promise<void> | void;
22
+ startSensitiveInstrumentation(passContext: LH.Gatherer.Context): Promise<void> | void;
24
23
  /**
25
24
  * Method to stop observing a page when the measurements are very sensitive and
26
25
  * should observe as little Lighthouse-induced work as possible.
27
26
  *
28
- * @param {LH.Gatherer.FRTransitionalContext} passContext
27
+ * @param {LH.Gatherer.Context} passContext
29
28
  * @return {Promise<void>|void}
30
29
  */
31
- stopSensitiveInstrumentation(passContext: LH.Gatherer.FRTransitionalContext): Promise<void> | void;
30
+ stopSensitiveInstrumentation(passContext: LH.Gatherer.Context): Promise<void> | void;
32
31
  /**
33
32
  * Method to end observing a page after an arbitrary period of time.
34
- * @param {LH.Gatherer.FRTransitionalContext} passContext
33
+ * @param {LH.Gatherer.Context} passContext
35
34
  * @return {Promise<void>|void}
36
35
  */
37
- stopInstrumentation(passContext: LH.Gatherer.FRTransitionalContext): Promise<void> | void;
36
+ stopInstrumentation(passContext: LH.Gatherer.Context): Promise<void> | void;
38
37
  /**
39
38
  * Method to gather results about a page.
40
- * @param {LH.Gatherer.FRTransitionalContext} passContext
39
+ * @param {LH.Gatherer.Context} passContext
41
40
  * @return {LH.Gatherer.PhaseResult}
42
41
  */
43
- getArtifact(passContext: LH.Gatherer.FRTransitionalContext): LH.Gatherer.PhaseResult;
44
- /**
45
- * Legacy property used to define the artifact ID. In Fraggle Rock, the artifact ID lives on the config.
46
- * @return {keyof LH.GathererArtifacts}
47
- */
48
- get name(): keyof LH.GathererArtifacts;
49
- /**
50
- * Legacy method. Called before navigation to target url, roughly corresponds to `startInstrumentation`.
51
- * @param {LH.Gatherer.PassContext} passContext
52
- * @return {Promise<LH.Gatherer.PhaseResultNonPromise>}
53
- */
54
- beforePass(passContext: LH.Gatherer.PassContext): Promise<LH.Gatherer.PhaseResultNonPromise>;
55
- /**
56
- * Legacy method. Should never be used by a Fraggle Rock gatherer, here for compat only.
57
- * @param {LH.Gatherer.PassContext} passContext
58
- * @return {LH.Gatherer.PhaseResult}
59
- */
60
- pass(passContext: LH.Gatherer.PassContext): LH.Gatherer.PhaseResult;
61
- /**
62
- * Legacy method. Roughly corresponds to `stopInstrumentation` or `getArtifact` depending on type of gatherer.
63
- * @param {LH.Gatherer.PassContext} passContext
64
- * @param {LH.Gatherer.LoadData} loadData
65
- * @return {Promise<LH.Gatherer.PhaseResultNonPromise>}
66
- */
67
- afterPass(passContext: LH.Gatherer.PassContext, loadData: LH.Gatherer.LoadData): Promise<LH.Gatherer.PhaseResultNonPromise>;
42
+ getArtifact(passContext: LH.Gatherer.Context): LH.Gatherer.PhaseResult;
68
43
  }
69
44
  import * as LH from '../../types/lh.js';
70
45
  //# sourceMappingURL=base-gatherer.d.ts.map
@@ -12,15 +12,14 @@ import * as LH from '../../types/lh.js';
12
12
  * Base class for all gatherers.
13
13
  *
14
14
  * @implements {LH.Gatherer.GathererInstance}
15
- * @implements {LH.Gatherer.FRGathererInstance}
16
15
  */
17
- class FRGatherer {
16
+ class BaseGatherer {
18
17
  /** @type {LH.Gatherer.GathererMeta} */
19
18
  meta = {supportedModes: []};
20
19
 
21
20
  /**
22
21
  * Method to start observing a page for an arbitrary period of time.
23
- * @param {LH.Gatherer.FRTransitionalContext} passContext
22
+ * @param {LH.Gatherer.Context} passContext
24
23
  * @return {Promise<void>|void}
25
24
  */
26
25
  startInstrumentation(passContext) { }
@@ -28,7 +27,7 @@ class FRGatherer {
28
27
  /**
29
28
  * Method to start observing a page when the measurements are very sensitive and
30
29
  * should observe as little Lighthouse-induced work as possible.
31
- * @param {LH.Gatherer.FRTransitionalContext} passContext
30
+ * @param {LH.Gatherer.Context} passContext
32
31
  * @return {Promise<void>|void}
33
32
  */
34
33
  startSensitiveInstrumentation(passContext) { }
@@ -37,70 +36,24 @@ class FRGatherer {
37
36
  * Method to stop observing a page when the measurements are very sensitive and
38
37
  * should observe as little Lighthouse-induced work as possible.
39
38
  *
40
- * @param {LH.Gatherer.FRTransitionalContext} passContext
39
+ * @param {LH.Gatherer.Context} passContext
41
40
  * @return {Promise<void>|void}
42
41
  */
43
42
  stopSensitiveInstrumentation(passContext) { }
44
43
 
45
44
  /**
46
45
  * Method to end observing a page after an arbitrary period of time.
47
- * @param {LH.Gatherer.FRTransitionalContext} passContext
46
+ * @param {LH.Gatherer.Context} passContext
48
47
  * @return {Promise<void>|void}
49
48
  */
50
49
  stopInstrumentation(passContext) { }
51
50
 
52
51
  /**
53
52
  * Method to gather results about a page.
54
- * @param {LH.Gatherer.FRTransitionalContext} passContext
53
+ * @param {LH.Gatherer.Context} passContext
55
54
  * @return {LH.Gatherer.PhaseResult}
56
55
  */
57
56
  getArtifact(passContext) { }
58
-
59
- /**
60
- * Legacy property used to define the artifact ID. In Fraggle Rock, the artifact ID lives on the config.
61
- * @return {keyof LH.GathererArtifacts}
62
- */
63
- get name() {
64
- let name = this.constructor.name;
65
- // Rollup will mangle class names in an known way–just trim until `$`.
66
- if (name.includes('$')) {
67
- name = name.substr(0, name.indexOf('$'));
68
- }
69
- // @ts-expect-error - assume that class name has been added to LH.GathererArtifacts.
70
- return name;
71
- }
72
-
73
- /**
74
- * Legacy method. Called before navigation to target url, roughly corresponds to `startInstrumentation`.
75
- * @param {LH.Gatherer.PassContext} passContext
76
- * @return {Promise<LH.Gatherer.PhaseResultNonPromise>}
77
- */
78
- async beforePass(passContext) {
79
- await this.startInstrumentation({...passContext, dependencies: {}});
80
- await this.startSensitiveInstrumentation({...passContext, dependencies: {}});
81
- }
82
-
83
- /**
84
- * Legacy method. Should never be used by a Fraggle Rock gatherer, here for compat only.
85
- * @param {LH.Gatherer.PassContext} passContext
86
- * @return {LH.Gatherer.PhaseResult}
87
- */
88
- pass(passContext) { }
89
-
90
- /**
91
- * Legacy method. Roughly corresponds to `stopInstrumentation` or `getArtifact` depending on type of gatherer.
92
- * @param {LH.Gatherer.PassContext} passContext
93
- * @param {LH.Gatherer.LoadData} loadData
94
- * @return {Promise<LH.Gatherer.PhaseResultNonPromise>}
95
- */
96
- async afterPass(passContext, loadData) {
97
- if ('dependencies' in this.meta) {
98
- throw Error('Gatherer with dependencies should override afterPass');
99
- }
100
- await this.stopSensitiveInstrumentation({...passContext, dependencies: {}});
101
- await this.stopInstrumentation({...passContext, dependencies: {}});
102
- return this.getArtifact({...passContext, dependencies: {}});
103
- }
104
57
  }
105
58
 
106
- export default FRGatherer;
59
+ export default BaseGatherer;
@@ -2,19 +2,19 @@
2
2
  * Resolves a backend node ID (from a trace event, protocol, etc) to the object ID for use with
3
3
  * `Runtime.callFunctionOn`. `undefined` means the node could not be found.
4
4
  *
5
- * @param {LH.Gatherer.FRProtocolSession} session
5
+ * @param {LH.Gatherer.ProtocolSession} session
6
6
  * @param {number} backendNodeId
7
7
  * @return {Promise<string|undefined>}
8
8
  */
9
- export function resolveNodeIdToObjectId(session: LH.Gatherer.FRProtocolSession, backendNodeId: number): Promise<string | undefined>;
9
+ export function resolveNodeIdToObjectId(session: LH.Gatherer.ProtocolSession, backendNodeId: number): Promise<string | undefined>;
10
10
  /**
11
11
  * Resolves a proprietary devtools node path (created from page-function.js) to the object ID for use
12
12
  * with `Runtime.callFunctionOn`. `undefined` means the node could not be found.
13
13
  * Requires `DOM.getDocument` to have been called since the object's creation or it will always be `undefined`.
14
14
  *
15
- * @param {LH.Gatherer.FRProtocolSession} session
15
+ * @param {LH.Gatherer.ProtocolSession} session
16
16
  * @param {string} path
17
17
  * @return {Promise<string|undefined>}
18
18
  */
19
- export function resolveDevtoolsNodePathToObjectId(session: LH.Gatherer.FRProtocolSession, path: string): Promise<string | undefined>;
19
+ export function resolveDevtoolsNodePathToObjectId(session: LH.Gatherer.ProtocolSession, path: string): Promise<string | undefined>;
20
20
  //# sourceMappingURL=dom.d.ts.map
@@ -22,7 +22,7 @@ function handlePotentialMissingNodeError(err) {
22
22
  * Resolves a backend node ID (from a trace event, protocol, etc) to the object ID for use with
23
23
  * `Runtime.callFunctionOn`. `undefined` means the node could not be found.
24
24
  *
25
- * @param {LH.Gatherer.FRProtocolSession} session
25
+ * @param {LH.Gatherer.ProtocolSession} session
26
26
  * @param {number} backendNodeId
27
27
  * @return {Promise<string|undefined>}
28
28
  */
@@ -40,7 +40,7 @@ async function resolveNodeIdToObjectId(session, backendNodeId) {
40
40
  * with `Runtime.callFunctionOn`. `undefined` means the node could not be found.
41
41
  * Requires `DOM.getDocument` to have been called since the object's creation or it will always be `undefined`.
42
42
  *
43
- * @param {LH.Gatherer.FRProtocolSession} session
43
+ * @param {LH.Gatherer.ProtocolSession} session
44
44
  * @param {string} path
45
45
  * @return {Promise<string|undefined>}
46
46
  */