lighthouse 9.1.0-dev.20211210 → 9.1.0-dev.20211214

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 (53) hide show
  1. package/dist/report/bundle.esm.js +3 -3
  2. package/dist/report/flow.js +1 -1
  3. package/dist/report/standalone.js +1 -1
  4. package/flow-report/assets/styles.css +1 -1
  5. package/lighthouse-core/audits/apple-touch-icon.js +2 -2
  6. package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +0 -3
  7. package/lighthouse-core/audits/no-unload-listeners.js +1 -1
  8. package/lighthouse-core/computed/critical-request-chains.js +2 -2
  9. package/lighthouse-core/computed/page-dependency-graph.js +25 -15
  10. package/lighthouse-core/computed/unused-css.js +3 -3
  11. package/lighthouse-core/config/default-config.js +1 -1
  12. package/lighthouse-core/fraggle-rock/gather/base-gatherer.js +1 -1
  13. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +19 -8
  14. package/lighthouse-core/fraggle-rock/user-flow.js +9 -5
  15. package/lighthouse-core/gather/driver/wait-for-condition.js +1 -1
  16. package/lighthouse-core/gather/gatherers/accessibility.js +1 -1
  17. package/lighthouse-core/gather/gatherers/anchor-elements.js +1 -1
  18. package/lighthouse-core/gather/gatherers/cache-contents.js +1 -1
  19. package/lighthouse-core/gather/gatherers/console-messages.js +1 -1
  20. package/lighthouse-core/gather/gatherers/dobetterweb/doctype.js +1 -1
  21. package/lighthouse-core/gather/gatherers/dobetterweb/domstats.js +1 -1
  22. package/lighthouse-core/gather/gatherers/dobetterweb/optimized-images.js +1 -1
  23. package/lighthouse-core/gather/gatherers/dobetterweb/password-inputs-with-prevented-paste.js +1 -1
  24. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -1
  25. package/lighthouse-core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +2 -2
  26. package/lighthouse-core/gather/gatherers/form-elements.js +3 -3
  27. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +1 -1
  28. package/lighthouse-core/gather/gatherers/global-listeners.js +1 -1
  29. package/lighthouse-core/gather/gatherers/iframe-elements.js +1 -1
  30. package/lighthouse-core/gather/gatherers/inspector-issues.js +1 -1
  31. package/lighthouse-core/gather/gatherers/js-usage.js +1 -1
  32. package/lighthouse-core/gather/gatherers/main-document-content.js +1 -1
  33. package/lighthouse-core/gather/gatherers/meta-elements.js +1 -1
  34. package/lighthouse-core/gather/gatherers/script-elements.js +1 -1
  35. package/lighthouse-core/gather/gatherers/seo/embedded-content.js +1 -1
  36. package/lighthouse-core/gather/gatherers/seo/font-size.js +1 -1
  37. package/lighthouse-core/gather/gatherers/seo/robots-txt.js +1 -1
  38. package/lighthouse-core/gather/gatherers/service-worker.js +1 -1
  39. package/lighthouse-core/gather/gatherers/source-maps.js +1 -1
  40. package/lighthouse-core/gather/gatherers/trace-elements.js +1 -1
  41. package/lighthouse-core/gather/gatherers/viewport-dimensions.js +1 -1
  42. package/lighthouse-core/lib/dependency-graph/base-node.js +8 -0
  43. package/lighthouse-core/lib/dependency-graph/simulator/network-analyzer.js +3 -2
  44. package/package.json +9 -8
  45. package/report/assets/styles.css +15 -12
  46. package/report/assets/templates.html +1 -1
  47. package/report/renderer/components.js +2 -2
  48. package/report/renderer/report-renderer.js +1 -1
  49. package/report/test-assets/faux-psi-template.html +85 -26
  50. package/report/test-assets/faux-psi.js +44 -8
  51. package/shared/localization/locales/en-US.json +1 -1
  52. package/shared/localization/locales/en-XL.json +1 -1
  53. package/types/config.d.ts +1 -0
@@ -8,12 +8,22 @@
8
8
  /** @fileoverview This file exercises two LH reports within the same DOM. */
9
9
 
10
10
  /** @typedef {import('../clients/bundle.js')} lighthouseRenderer */
11
-
12
11
  /** @type {lighthouseRenderer} */
13
12
  // @ts-expect-error
14
13
  const lighthouseRenderer = window['report'];
15
14
 
15
+ const wait = (ms = 100) => new Promise(resolve => setTimeout(resolve, ms));
16
+
17
+
16
18
  (async function __initPsiReports__() {
19
+ renderLHReport();
20
+
21
+ document.querySelector('button')?.addEventListener('click', () => {
22
+ renderLHReport();
23
+ });
24
+ })();
25
+
26
+ async function renderLHReport() {
17
27
  // @ts-expect-error
18
28
  const mobileLHR = window.__LIGHTHOUSE_JSON__;
19
29
  const desktopLHR = JSON.parse(JSON.stringify(mobileLHR));
@@ -26,25 +36,49 @@ const lighthouseRenderer = window['report'];
26
36
  for (const [tabId, lhr] of Object.entries(lhrs)) {
27
37
  await distinguishLHR(lhr, tabId);
28
38
 
29
- const container = document.querySelector(`section#${tabId}`);
39
+ const container = document.querySelector(`section#${tabId} .reportContainer`);
30
40
  if (!container) throw new Error('Unexpected DOM. Bailing.');
31
41
 
32
42
  try {
43
+ container.textContent = 'Analyzing…';
44
+ await wait(500);
45
+ for (const el of container.childNodes) el.remove();
46
+
33
47
  const reportRootEl = lighthouseRenderer.renderReport(lhr, {
34
48
  omitTopbar: true,
35
49
  disableAutoDarkModeAndFireworks: true,
36
50
  });
37
51
  // TODO: display warnings if appropriate.
38
- for (const el of reportRootEl.querySelectorAll('.lh-warnings')) {
52
+ for (const el of reportRootEl.querySelectorAll('.lh-warnings--toplevel')) {
39
53
  el.setAttribute('hidden', 'true');
40
54
  }
55
+
56
+ // Move env block
57
+ const metaItemsEl = reportRootEl.querySelector('.lh-meta__items');
58
+ if (metaItemsEl) {
59
+ reportRootEl.querySelector('.lh-metrics-container')?.parentNode?.insertBefore(
60
+ metaItemsEl,
61
+ reportRootEl.querySelector('.lh-buttons')
62
+ );
63
+ }
64
+
41
65
  container.append(reportRootEl);
66
+
67
+ // Override some LH styles. (To find .lh-vars we must descend from reportRootEl's parent)
68
+ for (const el of container.querySelectorAll('article.lh-vars')) {
69
+ // Ensure these css var names are not stale.
70
+ el.style.setProperty('--report-content-max-width', '100%');
71
+ el.style.setProperty('--edge-gap-padding', '0');
72
+ }
73
+ for (const el of reportRootEl.querySelectorAll('footer.lh-footer')) {
74
+ el.style.display = 'none';
75
+ }
42
76
  } catch (e) {
43
77
  console.error(e);
44
78
  container.textContent = 'Error: LHR failed to render.';
45
79
  }
46
80
  }
47
- })();
81
+ }
48
82
 
49
83
 
50
84
  /**
@@ -59,13 +93,15 @@ async function distinguishLHR(lhr, tabId) {
59
93
  }
60
94
 
61
95
  const finalSSDetails = lhr.audits['final-screenshot'] && lhr.audits['final-screenshot'].details;
62
- if (!finalSSDetails || finalSSDetails.type !== 'screenshot') throw new Error();
63
- finalSSDetails.data = await decorateScreenshot(finalSSDetails.data, tabId);
96
+ if (finalSSDetails && finalSSDetails.type === 'screenshot') {
97
+ finalSSDetails.data = await decorateScreenshot(finalSSDetails.data, tabId);
98
+ }
64
99
 
65
100
  const fpSSDetails = lhr.audits['full-page-screenshot'] &&
66
101
  lhr.audits['full-page-screenshot'].details;
67
- if (!fpSSDetails || fpSSDetails.type !== 'full-page-screenshot') throw new Error();
68
- fpSSDetails.screenshot.data = await decorateScreenshot(fpSSDetails.screenshot.data, tabId);
102
+ if (fpSSDetails && fpSSDetails.type === 'full-page-screenshot') {
103
+ fpSSDetails.screenshot.data = await decorateScreenshot(fpSSDetails.screenshot.data, tabId);
104
+ }
69
105
  }
70
106
 
71
107
  /**
@@ -1218,7 +1218,7 @@
1218
1218
  "message": "Server Backend Latencies"
1219
1219
  },
1220
1220
  "lighthouse-core/audits/no-unload-listeners.js | description": {
1221
- "message": "The `unload` event does not fire reliably and listening for it can prevent browser optimizations like the Back-Forward Cache. Consider using the `pagehide` or `visibilitychange` events instead. [Learn more](https://developers.google.com/web/updates/2018/07/page-lifecycle-api#the-unload-event)"
1221
+ "message": "The `unload` event does not fire reliably and listening for it can prevent browser optimizations like the Back-Forward Cache. Use `pagehide` or `visibilitychange` events instead. [Learn more](https://web.dev/bfcache/#never-use-the-unload-event)"
1222
1222
  },
1223
1223
  "lighthouse-core/audits/no-unload-listeners.js | failureTitle": {
1224
1224
  "message": "Registers an `unload` listener"
@@ -1218,7 +1218,7 @@
1218
1218
  "message": "Ŝér̂v́êŕ B̂áĉḱêńd̂ Ĺât́êńĉíêś"
1219
1219
  },
1220
1220
  "lighthouse-core/audits/no-unload-listeners.js | description": {
1221
- "message": "T̂h́ê `unload` év̂én̂t́ d̂óêś n̂ót̂ f́îŕê ŕêĺîáb̂ĺŷ án̂d́ l̂íŝt́êńîńĝ f́ôŕ ît́ ĉán̂ ṕr̂év̂én̂t́ b̂ŕôẃŝér̂ óp̂t́îḿîźât́îón̂ś l̂ík̂é t̂h́ê B́âćk̂-F́ôŕŵár̂d́ Ĉáĉh́ê. Ćôńŝíd̂ér̂ úŝín̂ǵ t̂h́ê `pagehide` ór̂ `visibilitychange` év̂én̂t́ŝ ín̂śt̂éâd́. [L̂éâŕn̂ ḿôŕê](https://developers.google.com/web/updates/2018/07/page-lifecycle-api#the-unload-event)"
1221
+ "message": "T̂h́ê `unload` év̂én̂t́ d̂óêś n̂ót̂ f́îŕê ŕêĺîáb̂ĺŷ án̂d́ l̂íŝt́êńîńĝ f́ôŕ ît́ ĉán̂ ṕr̂év̂én̂t́ b̂ŕôẃŝér̂ óp̂t́îḿîźât́îón̂ś l̂ík̂é t̂h́ê B́âćk̂-F́ôŕŵár̂d́ Ĉáĉh́ê. Úŝé `pagehide` ôŕ `visibilitychange` êv́êńt̂ś îńŝt́êád̂. [Ĺêár̂ń m̂ór̂é](https://web.dev/bfcache/#never-use-the-unload-event)"
1222
1222
  },
1223
1223
  "lighthouse-core/audits/no-unload-listeners.js | failureTitle": {
1224
1224
  "message": "R̂éĝíŝt́êŕŝ án̂ `unload` ĺîśt̂én̂ér̂"
package/types/config.d.ts CHANGED
@@ -65,6 +65,7 @@ declare module Config {
65
65
  gatherMode?: Gatherer.GatherMode;
66
66
  configPath?: string;
67
67
  settingsOverrides?: SharedFlagsSettings & Pick<LH.Flags, 'plugins'>;
68
+ skipAboutBlank?: boolean;
68
69
  }
69
70
 
70
71
  interface SharedPassNavigationJson {