lighthouse 8.6.0-dev.20211029 → 8.6.0-dev.20211102

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 (116) hide show
  1. package/dist/report/flow.js +14 -14
  2. package/dist/report/standalone.js +12 -12
  3. package/flow-report/.eslintrc.cjs +2 -0
  4. package/flow-report/assets/styles.css +1 -1
  5. package/flow-report/src/app.tsx +10 -11
  6. package/flow-report/src/common.tsx +22 -9
  7. package/flow-report/src/header.tsx +3 -3
  8. package/flow-report/src/i18n/i18n.tsx +10 -6
  9. package/flow-report/src/icons.tsx +21 -9
  10. package/flow-report/src/sidebar/flow.tsx +3 -3
  11. package/flow-report/src/sidebar/sidebar.tsx +12 -6
  12. package/flow-report/src/summary/category.tsx +9 -4
  13. package/flow-report/src/summary/summary.tsx +9 -3
  14. package/flow-report/src/util.ts +31 -19
  15. package/flow-report/src/wrappers/report-renderer.tsx +9 -3
  16. package/flow-report/src/wrappers/report.tsx +17 -7
  17. package/flow-report/test/common-test.tsx +25 -10
  18. package/flow-report/test/header-test.tsx +6 -6
  19. package/flow-report/test/setup/env-setup.ts +1 -1
  20. package/flow-report/test/summary/category-test.tsx +5 -5
  21. package/flow-report/test/util-test.tsx +32 -11
  22. package/lighthouse-cli/.eslintrc.cjs +2 -0
  23. package/lighthouse-cli/cli-flags.js +1 -1
  24. package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +4 -2
  25. package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
  26. package/lighthouse-core/audits/audit.js +1 -1
  27. package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +3 -4
  28. package/lighthouse-core/computed/metrics/tbt-utils.js +57 -0
  29. package/lighthouse-core/computed/metrics/total-blocking-time.js +3 -53
  30. package/lighthouse-core/computed/resource-summary.js +1 -1
  31. package/lighthouse-core/config/config-helpers.js +20 -10
  32. package/lighthouse-core/config/default-config.js +59 -55
  33. package/lighthouse-core/fraggle-rock/config/default-config.js +1 -1
  34. package/lighthouse-core/fraggle-rock/gather/base-gatherer.js +6 -1
  35. package/lighthouse-core/gather/connections/cri.js +1 -1
  36. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -0
  37. package/lighthouse-core/lib/asset-saver.js +4 -1
  38. package/lighthouse-core/lib/lh-env.js +2 -0
  39. package/lighthouse-core/lib/proto-preprocessor.js +14 -2
  40. package/lighthouse-core/lib/tappable-rects.js +8 -15
  41. package/lighthouse-core/lib/url-shim.js +1 -1
  42. package/lighthouse-core/runner.js +1 -1
  43. package/lighthouse-core/util-commonjs.js +25 -11
  44. package/package.json +11 -8
  45. package/report/.eslintrc.cjs +2 -0
  46. package/report/assets/styles.css +226 -250
  47. package/report/assets/templates.html +19 -29
  48. package/report/clients/standalone.js +0 -2
  49. package/report/renderer/category-renderer.js +21 -17
  50. package/report/renderer/components.js +21 -54
  51. package/report/renderer/crc-details-renderer.js +15 -12
  52. package/report/renderer/element-screenshot-renderer.js +2 -2
  53. package/report/renderer/open-tab.js +9 -3
  54. package/report/renderer/performance-category-renderer.js +51 -24
  55. package/report/renderer/report-renderer.js +2 -1
  56. package/report/renderer/report-ui-features.js +2 -3
  57. package/report/renderer/util.js +26 -11
  58. package/report/test/renderer/category-renderer-test.js +2 -2
  59. package/report/test/renderer/performance-category-renderer-test.js +35 -9
  60. package/report/test/renderer/report-renderer-test.js +1 -1
  61. package/report/test/renderer/report-ui-features-test.js +10 -9
  62. package/report/test/renderer/util-test.js +13 -31
  63. package/report/test-assets/faux-psi.js +5 -5
  64. package/shared/localization/format.js +9 -4
  65. package/shared/localization/locales/ar-XB.json +0 -15
  66. package/shared/localization/locales/ar.json +0 -15
  67. package/shared/localization/locales/bg.json +0 -15
  68. package/shared/localization/locales/ca.json +0 -15
  69. package/shared/localization/locales/cs.json +0 -15
  70. package/shared/localization/locales/da.json +0 -15
  71. package/shared/localization/locales/de.json +0 -15
  72. package/shared/localization/locales/el.json +0 -15
  73. package/shared/localization/locales/en-GB.json +0 -15
  74. package/shared/localization/locales/en-US.json +19 -16
  75. package/shared/localization/locales/en-XA.json +0 -15
  76. package/shared/localization/locales/en-XL.json +19 -16
  77. package/shared/localization/locales/es-419.json +0 -15
  78. package/shared/localization/locales/es.json +0 -15
  79. package/shared/localization/locales/fi.json +0 -15
  80. package/shared/localization/locales/fil.json +0 -15
  81. package/shared/localization/locales/fr.json +0 -15
  82. package/shared/localization/locales/he.json +0 -15
  83. package/shared/localization/locales/hi.json +0 -15
  84. package/shared/localization/locales/hr.json +0 -15
  85. package/shared/localization/locales/hu.json +0 -15
  86. package/shared/localization/locales/id.json +0 -15
  87. package/shared/localization/locales/it.json +0 -15
  88. package/shared/localization/locales/ja.json +0 -15
  89. package/shared/localization/locales/ko.json +0 -15
  90. package/shared/localization/locales/lt.json +0 -15
  91. package/shared/localization/locales/lv.json +0 -15
  92. package/shared/localization/locales/nl.json +0 -15
  93. package/shared/localization/locales/no.json +0 -15
  94. package/shared/localization/locales/pl.json +0 -15
  95. package/shared/localization/locales/pt-PT.json +0 -15
  96. package/shared/localization/locales/pt.json +0 -15
  97. package/shared/localization/locales/ro.json +0 -15
  98. package/shared/localization/locales/ru.json +0 -15
  99. package/shared/localization/locales/sk.json +0 -15
  100. package/shared/localization/locales/sl.json +0 -15
  101. package/shared/localization/locales/sr-Latn.json +0 -15
  102. package/shared/localization/locales/sr.json +0 -15
  103. package/shared/localization/locales/sv.json +0 -15
  104. package/shared/localization/locales/ta.json +0 -15
  105. package/shared/localization/locales/te.json +0 -15
  106. package/shared/localization/locales/th.json +0 -15
  107. package/shared/localization/locales/tr.json +0 -15
  108. package/shared/localization/locales/uk.json +0 -15
  109. package/shared/localization/locales/vi.json +0 -15
  110. package/shared/localization/locales/zh-HK.json +0 -15
  111. package/shared/localization/locales/zh-TW.json +0 -15
  112. package/shared/localization/locales/zh.json +0 -15
  113. package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
  114. package/types/lhr/flow.d.ts +3 -2
  115. package/types/rollup-plugin-postprocess.d.ts +10 -0
  116. package/lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js +0 -96
@@ -96,7 +96,7 @@ const UIStrings = {
96
96
  /** Description of the navigation section within the Search Engine Optimization (SEO) category. Within this section are audits with descriptive titles that highlight ways to make a website accessible to search engine crawlers. */
97
97
  seoCrawlingGroupDescription: 'To appear in search results, crawlers need access to your app.',
98
98
  /** Title of the Progressive Web Application (PWA) category of audits. This is displayed at the top of a list of audits focused on topics related to whether or not a site is a progressive web app, e.g. responds offline, uses a service worker, is on https, etc. Also used as a label of a score gauge. */
99
- pwaCategoryTitle: 'Progressive Web App',
99
+ pwaCategoryTitle: 'PWA',
100
100
  /** Description of the Progressive Web Application (PWA) category. This is displayed at the top of a list of audits focused on topics related to whether or not a site is a progressive web app, e.g. responds offline, uses a service worker, is on https, etc. No character length limits. 'Learn More' becomes link text to additional documentation. */
101
101
  pwaCategoryDescription: 'These checks validate the aspects of a Progressive Web App. ' +
102
102
  '[Learn more](https://developers.google.com/web/progressive-web-apps/checklist).',
@@ -303,7 +303,6 @@ const defaultConfig = {
303
303
  'dobetterweb/doctype',
304
304
  'dobetterweb/charset',
305
305
  'dobetterweb/dom-size',
306
- 'dobetterweb/external-anchors-use-rel-noopener',
307
306
  'dobetterweb/geolocation-on-start',
308
307
  'dobetterweb/inspector-issues',
309
308
  'dobetterweb/no-document-write',
@@ -405,6 +404,8 @@ const defaultConfig = {
405
404
  'best-practices-general': {
406
405
  title: str_(UIStrings.bestPracticesGeneralGroupTitle),
407
406
  },
407
+ // Group for audits that should not be displayed.
408
+ 'hidden': {title: ''},
408
409
  },
409
410
  categories: {
410
411
  'performance': {
@@ -418,61 +419,65 @@ const defaultConfig = {
418
419
  {id: 'total-blocking-time', weight: 30, group: 'metrics', acronym: 'TBT', relevantAudits: m2a.tbtRelevantAudits},
419
420
  {id: 'cumulative-layout-shift', weight: 15, group: 'metrics', acronym: 'CLS', relevantAudits: m2a.clsRelevantAudits},
420
421
 
421
- // These are our "invisible" metrics. Not displayed, but still in the LHR
422
- {id: 'max-potential-fid', weight: 0},
423
- {id: 'first-meaningful-paint', weight: 0, acronym: 'FMP'},
422
+ // These are our "invisible" metrics. Not displayed, but still in the LHR.
423
+ {id: 'max-potential-fid', weight: 0, group: 'hidden'},
424
+ {id: 'first-meaningful-paint', weight: 0, acronym: 'FMP', group: 'hidden'},
424
425
 
425
- {id: 'render-blocking-resources', weight: 0, group: 'load-opportunities'},
426
- {id: 'uses-responsive-images', weight: 0, group: 'load-opportunities'},
427
- {id: 'offscreen-images', weight: 0, group: 'load-opportunities'},
428
- {id: 'unminified-css', weight: 0, group: 'load-opportunities'},
429
- {id: 'unminified-javascript', weight: 0, group: 'load-opportunities'},
430
- {id: 'unused-css-rules', weight: 0, group: 'load-opportunities'},
431
- {id: 'unused-javascript', weight: 0, group: 'load-opportunities'},
432
- {id: 'uses-optimized-images', weight: 0, group: 'load-opportunities'},
433
- {id: 'modern-image-formats', weight: 0, group: 'load-opportunities'},
434
- {id: 'uses-text-compression', weight: 0, group: 'load-opportunities'},
435
- {id: 'uses-rel-preconnect', weight: 0, group: 'load-opportunities'},
436
- {id: 'server-response-time', weight: 0, group: 'load-opportunities'},
437
- {id: 'redirects', weight: 0, group: 'load-opportunities'},
438
- {id: 'uses-rel-preload', weight: 0, group: 'load-opportunities'},
439
- {id: 'uses-http2', weight: 0, group: 'load-opportunities'},
440
- {id: 'efficient-animated-content', weight: 0, group: 'load-opportunities'},
441
- {id: 'duplicated-javascript', weight: 0, group: 'load-opportunities'},
442
- {id: 'legacy-javascript', weight: 0, group: 'load-opportunities'},
443
- {id: 'preload-lcp-image', weight: 0, group: 'load-opportunities'},
444
- {id: 'total-byte-weight', weight: 0, group: 'diagnostics'},
445
- {id: 'uses-long-cache-ttl', weight: 0, group: 'diagnostics'},
446
- {id: 'dom-size', weight: 0, group: 'diagnostics'},
447
- {id: 'critical-request-chains', weight: 0, group: 'diagnostics'},
448
- {id: 'user-timings', weight: 0, group: 'diagnostics'},
449
- {id: 'bootup-time', weight: 0, group: 'diagnostics'},
450
- {id: 'mainthread-work-breakdown', weight: 0, group: 'diagnostics'},
451
- {id: 'font-display', weight: 0, group: 'diagnostics'},
426
+ // These audits will be put in "load-opportunities" or "diagnostics" based on their details type.
427
+ {id: 'render-blocking-resources', weight: 0},
428
+ {id: 'uses-responsive-images', weight: 0},
429
+ {id: 'offscreen-images', weight: 0},
430
+ {id: 'unminified-css', weight: 0},
431
+ {id: 'unminified-javascript', weight: 0},
432
+ {id: 'unused-css-rules', weight: 0},
433
+ {id: 'unused-javascript', weight: 0},
434
+ {id: 'uses-optimized-images', weight: 0},
435
+ {id: 'modern-image-formats', weight: 0},
436
+ {id: 'uses-text-compression', weight: 0},
437
+ {id: 'uses-rel-preconnect', weight: 0},
438
+ {id: 'server-response-time', weight: 0},
439
+ {id: 'redirects', weight: 0},
440
+ {id: 'uses-rel-preload', weight: 0},
441
+ {id: 'uses-http2', weight: 0},
442
+ {id: 'efficient-animated-content', weight: 0},
443
+ {id: 'duplicated-javascript', weight: 0},
444
+ {id: 'legacy-javascript', weight: 0},
445
+ {id: 'preload-lcp-image', weight: 0},
446
+ {id: 'total-byte-weight', weight: 0},
447
+ {id: 'uses-long-cache-ttl', weight: 0},
448
+ {id: 'dom-size', weight: 0},
449
+ {id: 'critical-request-chains', weight: 0},
450
+ {id: 'user-timings', weight: 0},
451
+ {id: 'bootup-time', weight: 0},
452
+ {id: 'mainthread-work-breakdown', weight: 0},
453
+ {id: 'font-display', weight: 0},
454
+ {id: 'resource-summary', weight: 0},
455
+ {id: 'third-party-summary', weight: 0},
456
+ {id: 'third-party-facades', weight: 0},
457
+ {id: 'largest-contentful-paint-element', weight: 0},
458
+ {id: 'lcp-lazy-loaded', weight: 0},
459
+ {id: 'layout-shift-elements', weight: 0},
460
+ {id: 'uses-passive-event-listeners', weight: 0},
461
+ {id: 'no-document-write', weight: 0},
462
+ {id: 'long-tasks', weight: 0},
463
+ {id: 'non-composited-animations', weight: 0},
464
+ {id: 'unsized-images', weight: 0},
465
+ {id: 'viewport', weight: 0},
466
+
467
+ // Budget audits.
452
468
  {id: 'performance-budget', weight: 0, group: 'budgets'},
453
469
  {id: 'timing-budget', weight: 0, group: 'budgets'},
454
- {id: 'resource-summary', weight: 0, group: 'diagnostics'},
455
- {id: 'third-party-summary', weight: 0, group: 'diagnostics'},
456
- {id: 'third-party-facades', weight: 0, group: 'diagnostics'},
457
- {id: 'largest-contentful-paint-element', weight: 0, group: 'diagnostics'},
458
- {id: 'lcp-lazy-loaded', weight: 0, group: 'diagnostics'},
459
- {id: 'layout-shift-elements', weight: 0, group: 'diagnostics'},
460
- {id: 'uses-passive-event-listeners', weight: 0, group: 'diagnostics'},
461
- {id: 'no-document-write', weight: 0, group: 'diagnostics'},
462
- {id: 'long-tasks', weight: 0, group: 'diagnostics'},
463
- {id: 'non-composited-animations', weight: 0, group: 'diagnostics'},
464
- {id: 'unsized-images', weight: 0, group: 'diagnostics'},
465
- {id: 'viewport', weight: 0, group: 'diagnostics'},
466
- // Audits past this point don't belong to a group and will not be shown automatically
467
- {id: 'network-requests', weight: 0},
468
- {id: 'network-rtt', weight: 0},
469
- {id: 'network-server-latency', weight: 0},
470
- {id: 'main-thread-tasks', weight: 0},
471
- {id: 'diagnostics', weight: 0},
472
- {id: 'metrics', weight: 0},
473
- {id: 'screenshot-thumbnails', weight: 0},
474
- {id: 'final-screenshot', weight: 0},
475
- {id: 'script-treemap-data', weight: 0},
470
+
471
+ // Audits past this point contain useful data but are not displayed with other audits.
472
+ {id: 'network-requests', weight: 0, group: 'hidden'},
473
+ {id: 'network-rtt', weight: 0, group: 'hidden'},
474
+ {id: 'network-server-latency', weight: 0, group: 'hidden'},
475
+ {id: 'main-thread-tasks', weight: 0, group: 'hidden'},
476
+ {id: 'diagnostics', weight: 0, group: 'hidden'},
477
+ {id: 'metrics', weight: 0, group: 'hidden'},
478
+ {id: 'screenshot-thumbnails', weight: 0, group: 'hidden'},
479
+ {id: 'final-screenshot', weight: 0, group: 'hidden'},
480
+ {id: 'script-treemap-data', weight: 0, group: 'hidden'},
476
481
  ],
477
482
  },
478
483
  'accessibility': {
@@ -548,7 +553,6 @@ const defaultConfig = {
548
553
  auditRefs: [
549
554
  // Trust & Safety
550
555
  {id: 'is-on-https', weight: 1, group: 'best-practices-trust-safety'},
551
- {id: 'external-anchors-use-rel-noopener', weight: 1, group: 'best-practices-trust-safety'},
552
556
  {id: 'geolocation-on-start', weight: 1, group: 'best-practices-trust-safety'},
553
557
  {id: 'notification-on-start', weight: 1, group: 'best-practices-trust-safety'},
554
558
  {id: 'no-vulnerable-libraries', weight: 1, group: 'best-practices-trust-safety'},
@@ -15,7 +15,7 @@ const frAudits = [
15
15
  /** @type {Record<string, LH.Config.AuditRefJson[]>} */
16
16
  const frCategoryAuditRefExtensions = {
17
17
  'performance': [
18
- {id: 'uses-responsive-images-snapshot', weight: 0, group: 'diagnostics'},
18
+ {id: 'uses-responsive-images-snapshot', weight: 0},
19
19
  ],
20
20
  };
21
21
 
@@ -62,8 +62,13 @@ class FRGatherer {
62
62
  * @return {keyof LH.GathererArtifacts}
63
63
  */
64
64
  get name() {
65
+ let name = this.constructor.name;
66
+ // Rollup will mangle class names in an known way–just trim until `$`.
67
+ if (name.includes('$')) {
68
+ name = name.substr(0, name.indexOf('$'));
69
+ }
65
70
  // @ts-expect-error - assume that class name has been added to LH.GathererArtifacts.
66
- return this.constructor.name;
71
+ return name;
67
72
  }
68
73
 
69
74
  /**
@@ -11,7 +11,7 @@ const http = require('http');
11
11
  const log = require('lighthouse-logger');
12
12
  const LighthouseError = require('../../lib/lh-error.js');
13
13
 
14
- const DEFAULT_HOSTNAME = 'localhost';
14
+ const DEFAULT_HOSTNAME = '127.0.0.1';
15
15
  const CONNECT_TIMEOUT = 10000;
16
16
  const DEFAULT_PORT = 9222;
17
17
 
@@ -10,6 +10,7 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
+ const {Buffer} = require('buffer');
13
14
  const FRGatherer = require('../../../fraggle-rock/gather/base-gatherer.js');
14
15
  const URL = require('../../../lib/url-shim.js');
15
16
  const Sentry = require('../../../lib/sentry.js');
@@ -16,7 +16,10 @@ const Metrics = require('./traces/pwmetrics-events.js');
16
16
  const NetworkAnalysisComputed = require('../computed/network-analysis.js');
17
17
  const LoadSimulatorComputed = require('../computed/load-simulator.js');
18
18
  const LHError = require('../lib/lh-error.js');
19
- const pipeline = promisify(stream.pipeline);
19
+ // TODO(esmodules): Rollup does not support `promisfy` or `stream.pipeline`. Bundled files
20
+ // don't need anything in this file except for `stringifyReplacer`, so a check for
21
+ // truthiness before using is enough.
22
+ const pipeline = promisify && promisify(stream.pipeline);
20
23
 
21
24
  const artifactsFilename = 'artifacts.json';
22
25
  const traceSuffix = '.trace.json';
@@ -5,6 +5,8 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
+ const process = require('process');
9
+
8
10
  module.exports = {
9
11
  // NODE_ENV is set to test by jest and by smokehouse CLI runner
10
12
  // CI as a catchall for everything we do in GitHub Actions
@@ -29,10 +29,22 @@ function processForProto(lhr) {
29
29
  // 'ignore unknown fields' in the language of conversion.
30
30
  if (reportJson.configSettings) {
31
31
  // The settings that are in both proto and LHR
32
- const {formFactor, locale, onlyCategories, channel} = reportJson.configSettings;
32
+ const {
33
+ formFactor,
34
+ locale,
35
+ onlyCategories,
36
+ channel,
37
+ throttling,
38
+ throttlingMethod} = reportJson.configSettings;
33
39
 
34
40
  // @ts-expect-error - intentionally only a subset of settings.
35
- reportJson.configSettings = {formFactor, locale, onlyCategories, channel};
41
+ reportJson.configSettings = {
42
+ formFactor,
43
+ locale,
44
+ onlyCategories,
45
+ channel,
46
+ throttling,
47
+ throttlingMethod};
36
48
  }
37
49
 
38
50
  // Remove runtimeError if it is NO_ERROR
@@ -5,14 +5,7 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- const {
9
- filterOutRectsContainedByOthers,
10
- filterOutTinyRects,
11
- rectsTouchOrOverlap,
12
- rectContainsPoint,
13
- getBoundingRect,
14
- getRectCenterPoint,
15
- } = require('./rect-helpers.js');
8
+ const RectHelpers = require('./rect-helpers.js');
16
9
 
17
10
  /**
18
11
  * Merge client rects together and remove small ones. This may result in a larger overall
@@ -23,8 +16,8 @@ const {
23
16
  function getTappableRectsFromClientRects(clientRects) {
24
17
  // 1x1px rect shouldn't be reason to treat the rect as something the user should tap on.
25
18
  // Often they're made invisble in some obscure way anyway, and only exist for e.g. accessibiliity.
26
- clientRects = filterOutTinyRects(clientRects);
27
- clientRects = filterOutRectsContainedByOthers(clientRects);
19
+ clientRects = RectHelpers.filterOutTinyRects(clientRects);
20
+ clientRects = RectHelpers.filterOutRectsContainedByOthers(clientRects);
28
21
  clientRects = mergeTouchingClientRects(clientRects);
29
22
  return clientRects;
30
23
  }
@@ -68,17 +61,17 @@ function mergeTouchingClientRects(clientRects) {
68
61
  const rectsLineUpVertically =
69
62
  almostEqual(crA.left, crB.left) || almostEqual(crA.right, crB.right);
70
63
  const canMerge =
71
- rectsTouchOrOverlap(crA, crB) &&
64
+ RectHelpers.rectsTouchOrOverlap(crA, crB) &&
72
65
  (rectsLineUpHorizontally || rectsLineUpVertically);
73
66
 
74
67
  if (canMerge) {
75
- const replacementClientRect = getBoundingRect([crA, crB]);
76
- const mergedRectCenter = getRectCenterPoint(replacementClientRect);
68
+ const replacementClientRect = RectHelpers.getBoundingRect([crA, crB]);
69
+ const mergedRectCenter = RectHelpers.getRectCenterPoint(replacementClientRect);
77
70
 
78
71
  if (
79
72
  !(
80
- rectContainsPoint(crA, mergedRectCenter) ||
81
- rectContainsPoint(crB, mergedRectCenter)
73
+ RectHelpers.rectContainsPoint(crA, mergedRectCenter) ||
74
+ RectHelpers.rectContainsPoint(crB, mergedRectCenter)
82
75
  )
83
76
  ) {
84
77
  // Don't merge because the new shape is too different from the
@@ -9,7 +9,7 @@
9
9
  * URL shim so we keep our code DRY
10
10
  */
11
11
 
12
- const Util = require('../util-commonjs.js');
12
+ const {Util} = require('../util-commonjs.js');
13
13
 
14
14
  /** @typedef {import('./network-request.js')} NetworkRequest */
15
15
 
@@ -20,6 +20,7 @@ const URL = require('./lib/url-shim.js');
20
20
  const Sentry = require('./lib/sentry.js');
21
21
  const generateReport = require('../report/generator/report-generator.js').generateReport;
22
22
  const LHError = require('./lib/lh-error.js');
23
+ const {version: lighthouseVersion} = require('../package.json');
23
24
 
24
25
  /** @typedef {import('./gather/connections/connection.js')} Connection */
25
26
  /** @typedef {import('./lib/arbitrary-equality-map.js')} ArbitraryEqualityMap */
@@ -112,7 +113,6 @@ class Runner {
112
113
  }
113
114
 
114
115
  // Entering: conclusion of the lighthouse result object
115
- const lighthouseVersion = require('../package.json').version;
116
116
 
117
117
  // Use version from gathering stage.
118
118
  // If accessibility gatherer didn't run or errored, it won't be in credits.
@@ -42,6 +42,10 @@ const listOfTlds = [
42
42
  ];
43
43
 
44
44
  class Util {
45
+ /** @type {I18n<typeof UIStrings>} */
46
+ // @ts-expect-error: Is set in report renderer.
47
+ static i18n = null;
48
+
45
49
  static get PASS_THRESHOLD() {
46
50
  return PASS_THRESHOLD;
47
51
  }
@@ -420,7 +424,7 @@ class Util {
420
424
  throttling.downloadThroughputKbps === 1.6 * 1024 * 0.9 &&
421
425
  throttling.uploadThroughputKbps === 750 * 0.9;
422
426
  };
423
- summary = `${isSlow4G() ? 'Slow 4G' : 'Custom'} throttling by DevTools`;
427
+ summary = isSlow4G() ? Util.i18n.strings.runtimeSlow4g : Util.i18n.strings.runtimeCustom;
424
428
  break;
425
429
  }
426
430
  case 'simulate': {
@@ -432,7 +436,7 @@ class Util {
432
436
  const isSlow4G = () => {
433
437
  return rttMs === 150 && throughputKbps === 1.6 * 1024;
434
438
  };
435
- summary = isSlow4G() ? 'Simulated slow 4G' : 'Custom simulated throttling';
439
+ summary = isSlow4G() ? Util.i18n.strings.runtimeSlow4g : Util.i18n.strings.runtimeCustom;
436
440
  break;
437
441
  }
438
442
  default:
@@ -519,10 +523,9 @@ class Util {
519
523
  let totalWeight = 0;
520
524
  for (const auditRef of category.auditRefs) {
521
525
  const auditPassed = Util.showAsPassed(auditRef.result);
522
- const notDisplayed = !auditRef.group && category.id === 'performance';
523
526
 
524
527
  // Don't count the audit if it's manual, N/A, or isn't displayed.
525
- if (notDisplayed ||
528
+ if (auditRef.group === 'hidden' ||
526
529
  auditRef.result.scoreDisplayMode === 'manual' ||
527
530
  auditRef.result.scoreDisplayMode === 'notApplicable') {
528
531
  continue;
@@ -558,14 +561,10 @@ Util.getUniqueSuffix = (() => {
558
561
  };
559
562
  })();
560
563
 
561
- /** @type {I18n<typeof Util['UIStrings']>} */
562
- // @ts-expect-error: Is set in report renderer.
563
- Util.i18n = null;
564
-
565
564
  /**
566
565
  * Report-renderer-specific strings.
567
566
  */
568
- Util.UIStrings = {
567
+ const UIStrings = {
569
568
  /** Disclaimer shown to users below the metric values (First Contentful Paint, Time to Interactive, etc) to warn them that the numbers they see will likely change slightly the next time they run Lighthouse. */
570
569
  varianceDisclaimer: 'Values are estimated and may vary. The [performance score is calculated](https://web.dev/performance-scoring/) directly from these metrics.',
571
570
  /** Text link pointing to an interactive calculator that explains Lighthouse scoring. The link text should be fairly short. */
@@ -665,7 +664,22 @@ Util.UIStrings = {
665
664
 
666
665
  /** Descriptive explanation for environment throttling that was provided by the runtime environment instead of provided by Lighthouse throttling. */
667
666
  throttlingProvided: 'Provided by environment',
667
+ /** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Show' and 'Hide'. */
668
+ show: 'Show',
669
+ /** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Show' and 'Hide'. */
670
+ hide: 'Hide',
671
+ /** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Expand view' and 'Collapse view'. */
672
+ expandView: 'Expand view',
673
+ /** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Expand view' and 'Collapse view'. */
674
+ collapseView: 'Collapse view',
675
+ /** Label indicating that Lighthouse throttled the page to emulate a slow 4G network connection. */
676
+ runtimeSlow4g: 'Slow 4G throttling',
677
+ /** Label indicating that Lighthouse throttled the page using custom throttling settings. */
678
+ runtimeCustom: 'Custom throttling',
668
679
  };
680
+ Util.UIStrings = UIStrings;
669
681
 
670
-
671
- module.exports = Util;
682
+ module.exports = {
683
+ Util,
684
+ UIStrings,
685
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "8.6.0-dev.20211029",
3
+ "version": "8.6.0-dev.20211102",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  "build-smokehouse-bundle": "node ./build/build-smokehouse-bundle.js",
25
25
  "build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js",
26
26
  "build-pack": "bash build/build-pack.sh",
27
- "build-report": "node build/build-report-components.js && yarn eslint --fix report/renderer/components.js && node build/build-report.js && bash lighthouse-core/scripts/copy-util-commonjs.sh",
27
+ "build-report": "node build/build-report-components.js && yarn eslint --fix report/renderer/components.js && bash lighthouse-core/scripts/copy-util-commonjs.sh && node build/build-report.js",
28
28
  "build-sample-reports": "yarn build-report && node build/build-sample-reports.js",
29
29
  "build-treemap": "node ./build/build-treemap.js",
30
30
  "build-viewer": "node ./build/build-viewer.js",
@@ -95,9 +95,16 @@
95
95
  },
96
96
  "devDependencies": {
97
97
  "@build-tracker/cli": "^1.0.0-beta.15",
98
+ "@firebase/app-types": "0.3.1",
99
+ "@firebase/auth-types": "0.3.2",
100
+ "@firebase/util": "0.2.1",
101
+ "@rollup/plugin-alias": "^3.1.2",
98
102
  "@rollup/plugin-commonjs": "^20.0.0",
103
+ "@rollup/plugin-dynamic-import-vars": "^1.1.1",
104
+ "@rollup/plugin-json": "^4.1.0",
99
105
  "@rollup/plugin-node-resolve": "^13.0.4",
100
106
  "@rollup/plugin-typescript": "^8.2.5",
107
+ "@stadtlandnetz/rollup-plugin-postprocess": "^1.1.0",
101
108
  "@testing-library/preact": "^2.0.1",
102
109
  "@testing-library/preact-hooks": "^1.1.0",
103
110
  "@types/archiver": "^2.1.2",
@@ -107,7 +114,6 @@
107
114
  "@types/cpy": "^5.1.0",
108
115
  "@types/eslint": "^4.16.6",
109
116
  "@types/estree": "^0.0.50",
110
- "@types/exorcist": "^0.4.5",
111
117
  "@types/gh-pages": "^2.0.0",
112
118
  "@types/google.analytics": "0.0.39",
113
119
  "@types/jest": "^24.0.9",
@@ -133,7 +139,6 @@
133
139
  "angular": "^1.7.4",
134
140
  "archiver": "^3.0.0",
135
141
  "browserify": "^17.0.0",
136
- "browserify-banner": "^1.0.15",
137
142
  "c8": "^7.4.0",
138
143
  "chalk": "^2.4.1",
139
144
  "chrome-devtools-frontend": "1.0.922924",
@@ -148,7 +153,6 @@
148
153
  "eslint-plugin-import": "^2.24.2",
149
154
  "eslint-plugin-local-rules": "0.1.0",
150
155
  "event-target-shim": "^6.0.2",
151
- "exorcist": "^1.0.1",
152
156
  "firebase": "^9.0.2",
153
157
  "gh-pages": "^2.0.1",
154
158
  "glob": "^7.1.3",
@@ -163,13 +167,12 @@
163
167
  "mime-types": "^2.1.30",
164
168
  "node-fetch": "^2.6.1",
165
169
  "npm-run-posix-or-windows": "^2.0.2",
166
- "package-json-versionify": "^1.0.4",
167
170
  "pako": "^2.0.3",
168
171
  "preact": "^10.5.14",
169
172
  "pretty-json-stringify": "^0.0.2",
170
173
  "puppeteer": "^10.2.0",
171
174
  "resolve": "^1.20.0",
172
- "rollup": "^2.50.6",
175
+ "rollup": "^2.52.7",
173
176
  "rollup-plugin-node-resolve": "^5.2.0",
174
177
  "rollup-plugin-polyfill-node": "^0.7.0",
175
178
  "rollup-plugin-replace": "^2.2.0",
@@ -185,7 +188,7 @@
185
188
  },
186
189
  "dependencies": {
187
190
  "axe-core": "4.2.3",
188
- "chrome-launcher": "^0.14.0",
191
+ "chrome-launcher": "^0.14.2",
189
192
  "configstore": "^5.0.1",
190
193
  "csp_evaluator": "1.1.0",
191
194
  "cssstyle": "1.2.1",
@@ -29,5 +29,7 @@ module.exports = {
29
29
  ],
30
30
  'newlines-between': 'always',
31
31
  }],
32
+ 'import/group-exports': 2,
33
+ 'import/exports-last': 2,
32
34
  },
33
35
  };