lighthouse 9.5.0-dev.20221117 → 9.5.0-dev.20221118

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.
package/core/index.js CHANGED
@@ -184,6 +184,8 @@ export default lighthouse;
184
184
  export {Audit} from './audits/audit.js';
185
185
  export {default as Gatherer} from './gather/base-gatherer.js';
186
186
  export {NetworkRecords} from './computed/network-records.js';
187
+ export {default as defaultConfig} from './config/default-config.js';
188
+ export {default as desktopConfig} from './config/desktop-config.js';
187
189
  export {
188
190
  legacyNavigation,
189
191
  startFlow,
package/core/util.cjs CHANGED
@@ -470,7 +470,7 @@ class Util {
470
470
 
471
471
  /**
472
472
  * @param {LH.Result['configSettings']} settings
473
- * @return {!{deviceEmulation: string, networkThrottling: string, cpuThrottling: string, summary: string}}
473
+ * @return {!{deviceEmulation: string, screenEmulation?: string, networkThrottling: string, cpuThrottling: string, summary: string}}
474
474
  */
475
475
  static getEmulationDescriptions(settings) {
476
476
  let cpuThrottling;
@@ -516,14 +516,19 @@ class Util {
516
516
  summary = cpuThrottling = networkThrottling = Util.i18n.strings.runtimeUnknown;
517
517
  }
518
518
 
519
- // TODO(paulirish): revise Runtime Settings strings: https://github.com/GoogleChrome/lighthouse/pull/11796
520
519
  const deviceEmulation = {
521
520
  mobile: Util.i18n.strings.runtimeMobileEmulation,
522
521
  desktop: Util.i18n.strings.runtimeDesktopEmulation,
523
522
  }[settings.formFactor] || Util.i18n.strings.runtimeNoEmulation;
524
523
 
524
+ const screenEmulation = settings.screenEmulation.disabled ?
525
+ undefined :
526
+ // eslint-disable-next-line max-len
527
+ `${settings.screenEmulation.width}x${settings.screenEmulation.height}, DPR ${settings.screenEmulation.deviceScaleFactor}`;
528
+
525
529
  return {
526
530
  deviceEmulation,
531
+ screenEmulation,
527
532
  cpuThrottling,
528
533
  networkThrottling,
529
534
  summary,
@@ -721,6 +726,8 @@ const UIStrings = {
721
726
  runtimeSettingsBenchmark: 'CPU/Memory Power',
722
727
  /** Label for a row in a table that shows the version of the Axe library used. Example row values: 2.1.0, 3.2.3 */
723
728
  runtimeSettingsAxeVersion: 'Axe version',
729
+ /** Label for a row in a table that shows the screen resolution and DPR that was emulated for the Lighthouse run. Example values: '800x600, DPR: 3' */
730
+ runtimeSettingsScreenEmulation: 'Screen emulation',
724
731
 
725
732
  /** Label for button to create an issue against the Lighthouse GitHub project. */
726
733
  footerIssue: 'File an issue',
@@ -466,7 +466,7 @@ class Util {
466
466
 
467
467
  /**
468
468
  * @param {LH.Result['configSettings']} settings
469
- * @return {!{deviceEmulation: string, networkThrottling: string, cpuThrottling: string, summary: string}}
469
+ * @return {!{deviceEmulation: string, screenEmulation?: string, networkThrottling: string, cpuThrottling: string, summary: string}}
470
470
  */
471
471
  static getEmulationDescriptions(settings) {
472
472
  let cpuThrottling;
@@ -512,14 +512,19 @@ class Util {
512
512
  summary = cpuThrottling = networkThrottling = Util.i18n.strings.runtimeUnknown;
513
513
  }
514
514
 
515
- // TODO(paulirish): revise Runtime Settings strings: https://github.com/GoogleChrome/lighthouse/pull/11796
516
515
  const deviceEmulation = {
517
516
  mobile: Util.i18n.strings.runtimeMobileEmulation,
518
517
  desktop: Util.i18n.strings.runtimeDesktopEmulation,
519
518
  }[settings.formFactor] || Util.i18n.strings.runtimeNoEmulation;
520
519
 
520
+ const screenEmulation = settings.screenEmulation.disabled ?
521
+ undefined :
522
+ // eslint-disable-next-line max-len
523
+ `${settings.screenEmulation.width}x${settings.screenEmulation.height}, DPR ${settings.screenEmulation.deviceScaleFactor}`;
524
+
521
525
  return {
522
526
  deviceEmulation,
527
+ screenEmulation,
523
528
  cpuThrottling,
524
529
  networkThrottling,
525
530
  summary,
@@ -717,6 +722,8 @@ const UIStrings = {
717
722
  runtimeSettingsBenchmark: 'CPU/Memory Power',
718
723
  /** Label for a row in a table that shows the version of the Axe library used. Example row values: 2.1.0, 3.2.3 */
719
724
  runtimeSettingsAxeVersion: 'Axe version',
725
+ /** Label for a row in a table that shows the screen resolution and DPR that was emulated for the Lighthouse run. Example values: '800x600, DPR: 3' */
726
+ runtimeSettingsScreenEmulation: 'Screen emulation',
720
727
 
721
728
  /** Label for button to create an issue against the Lighthouse GitHub project. */
722
729
  footerIssue: 'File an issue',
@@ -4343,8 +4350,6 @@ class ReportRenderer {
4343
4350
  */
4344
4351
  _renderMetaBlock(report, footer) {
4345
4352
  const envValues = Util.getEmulationDescriptions(report.configSettings || {});
4346
-
4347
-
4348
4353
  const match = report.userAgent.match(/(\w*Chrome\/[\d.]+)/); // \w* to include 'HeadlessChrome'
4349
4354
  const chromeVer = Array.isArray(match)
4350
4355
  ? match[1].replace('/', ' ').replace('Chrome', 'Chromium')
@@ -4353,15 +4358,25 @@ class ReportRenderer {
4353
4358
  const benchmarkIndex = report.environment.benchmarkIndex.toFixed(0);
4354
4359
  const axeVersion = report.environment.credits?.['axe-core'];
4355
4360
 
4361
+ const devicesTooltipTextLines = [
4362
+ `${Util.i18n.strings.runtimeSettingsBenchmark}: ${benchmarkIndex}`,
4363
+ `${Util.i18n.strings.runtimeSettingsCPUThrottling}: ${envValues.cpuThrottling}`,
4364
+ ];
4365
+ if (envValues.screenEmulation) {
4366
+ devicesTooltipTextLines.push(
4367
+ `${Util.i18n.strings.runtimeSettingsScreenEmulation}: ${envValues.screenEmulation}`);
4368
+ }
4369
+ if (axeVersion) {
4370
+ devicesTooltipTextLines.push(`${Util.i18n.strings.runtimeSettingsAxeVersion}: ${axeVersion}`);
4371
+ }
4372
+
4356
4373
  // [CSS icon class, textContent, tooltipText]
4357
4374
  const metaItems = [
4358
4375
  ['date',
4359
4376
  `Captured at ${Util.i18n.formatDateTime(report.fetchTime)}`],
4360
4377
  ['devices',
4361
4378
  `${envValues.deviceEmulation} with Lighthouse ${report.lighthouseVersion}`,
4362
- `${Util.i18n.strings.runtimeSettingsBenchmark}: ${benchmarkIndex}` +
4363
- `\n${Util.i18n.strings.runtimeSettingsCPUThrottling}: ${envValues.cpuThrottling}` +
4364
- (axeVersion ? `\n${Util.i18n.strings.runtimeSettingsAxeVersion}: ${axeVersion}` : '')],
4379
+ devicesTooltipTextLines.join('\n')],
4365
4380
  ['samples-one',
4366
4381
  Util.i18n.strings.runtimeSingleLoad,
4367
4382
  Util.i18n.strings.runtimeSingleLoadTooltip],