lighthouse 11.7.0-dev.20240409 → 11.7.0-dev.20240410

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 (100) hide show
  1. package/cli/cli-flags.js +3 -3
  2. package/cli/test/smokehouse/core-tests.js +0 -16
  3. package/cli/test/smokehouse/frontends/smokehouse-bin.js +2 -2
  4. package/core/config/default-config.js +6 -50
  5. package/core/lib/lantern/network-node.js +28 -4
  6. package/dist/report/bundle.esm.js +11 -95
  7. package/dist/report/flow.js +16 -100
  8. package/dist/report/standalone.js +12 -96
  9. package/flow-report/src/help-dialog.tsx +0 -1
  10. package/flow-report/src/i18n/i18n.d.ts +0 -4
  11. package/flow-report/src/i18n/ui-strings.d.ts +0 -1
  12. package/flow-report/src/i18n/ui-strings.js +0 -2
  13. package/package.json +1 -1
  14. package/readme.md +2 -2
  15. package/report/assets/styles.css +1 -43
  16. package/report/assets/templates.html +0 -95
  17. package/report/renderer/components.d.ts +2 -2
  18. package/report/renderer/components.js +2 -103
  19. package/report/renderer/report-renderer.js +2 -12
  20. package/report/renderer/report-ui-features.js +1 -1
  21. package/report/renderer/report-utils.d.ts +0 -1
  22. package/report/renderer/report-utils.js +0 -3
  23. package/shared/localization/locales/ar-XB.json +0 -174
  24. package/shared/localization/locales/ar.json +0 -174
  25. package/shared/localization/locales/bg.json +0 -174
  26. package/shared/localization/locales/ca.json +0 -174
  27. package/shared/localization/locales/cs.json +0 -174
  28. package/shared/localization/locales/da.json +0 -174
  29. package/shared/localization/locales/de.json +0 -174
  30. package/shared/localization/locales/el.json +0 -174
  31. package/shared/localization/locales/en-GB.json +0 -174
  32. package/shared/localization/locales/en-US.json +0 -177
  33. package/shared/localization/locales/en-XA.json +0 -174
  34. package/shared/localization/locales/en-XL.json +0 -177
  35. package/shared/localization/locales/es-419.json +0 -174
  36. package/shared/localization/locales/es.json +0 -174
  37. package/shared/localization/locales/fi.json +0 -174
  38. package/shared/localization/locales/fil.json +0 -174
  39. package/shared/localization/locales/fr.json +0 -174
  40. package/shared/localization/locales/he.json +0 -174
  41. package/shared/localization/locales/hi.json +0 -174
  42. package/shared/localization/locales/hr.json +0 -174
  43. package/shared/localization/locales/hu.json +0 -174
  44. package/shared/localization/locales/id.json +0 -174
  45. package/shared/localization/locales/it.json +0 -174
  46. package/shared/localization/locales/ja.json +0 -174
  47. package/shared/localization/locales/ko.json +0 -174
  48. package/shared/localization/locales/lt.json +0 -174
  49. package/shared/localization/locales/lv.json +0 -174
  50. package/shared/localization/locales/nl.json +0 -174
  51. package/shared/localization/locales/no.json +0 -174
  52. package/shared/localization/locales/pl.json +0 -174
  53. package/shared/localization/locales/pt-PT.json +0 -174
  54. package/shared/localization/locales/pt.json +0 -174
  55. package/shared/localization/locales/ro.json +0 -174
  56. package/shared/localization/locales/ru.json +0 -174
  57. package/shared/localization/locales/sk.json +0 -174
  58. package/shared/localization/locales/sl.json +0 -174
  59. package/shared/localization/locales/sr-Latn.json +0 -174
  60. package/shared/localization/locales/sr.json +0 -174
  61. package/shared/localization/locales/sv.json +0 -174
  62. package/shared/localization/locales/ta.json +0 -174
  63. package/shared/localization/locales/te.json +0 -174
  64. package/shared/localization/locales/th.json +0 -174
  65. package/shared/localization/locales/tr.json +0 -174
  66. package/shared/localization/locales/uk.json +0 -174
  67. package/shared/localization/locales/vi.json +0 -174
  68. package/shared/localization/locales/zh-HK.json +0 -174
  69. package/shared/localization/locales/zh-TW.json +0 -174
  70. package/shared/localization/locales/zh.json +0 -174
  71. package/types/artifacts.d.ts +0 -27
  72. package/types/audit.d.ts +0 -10
  73. package/types/internal/smokehouse.d.ts +1 -1
  74. package/core/audits/content-width.d.ts +0 -17
  75. package/core/audits/content-width.js +0 -76
  76. package/core/audits/installable-manifest.d.ts +0 -111
  77. package/core/audits/installable-manifest.js +0 -248
  78. package/core/audits/manual/pwa-cross-browser.d.ts +0 -12
  79. package/core/audits/manual/pwa-cross-browser.js +0 -40
  80. package/core/audits/manual/pwa-each-page-has-url.d.ts +0 -12
  81. package/core/audits/manual/pwa-each-page-has-url.js +0 -38
  82. package/core/audits/manual/pwa-page-transitions.d.ts +0 -12
  83. package/core/audits/manual/pwa-page-transitions.js +0 -38
  84. package/core/audits/maskable-icon.d.ts +0 -25
  85. package/core/audits/maskable-icon.js +0 -70
  86. package/core/audits/multi-check-audit.d.ts +0 -28
  87. package/core/audits/multi-check-audit.js +0 -82
  88. package/core/audits/splash-screen.d.ts +0 -37
  89. package/core/audits/splash-screen.js +0 -98
  90. package/core/audits/themed-omnibox.d.ts +0 -42
  91. package/core/audits/themed-omnibox.js +0 -102
  92. package/core/computed/manifest-values.d.ts +0 -24
  93. package/core/computed/manifest-values.js +0 -136
  94. package/core/gather/gatherers/installability-errors.d.ts +0 -17
  95. package/core/gather/gatherers/installability-errors.js +0 -56
  96. package/core/gather/gatherers/web-app-manifest.d.ts +0 -32
  97. package/core/gather/gatherers/web-app-manifest.js +0 -106
  98. package/report/renderer/pwa-category-renderer.d.ts +0 -55
  99. package/report/renderer/pwa-category-renderer.js +0 -184
  100. package/third-party/chromium-synchronization/installability-errors-test.js +0 -79
package/cli/cli-flags.js CHANGED
@@ -53,8 +53,8 @@ function getYargsParser(manualArgv) {
53
53
  'lighthouse <url> --extra-headers=./path/to/file.json',
54
54
  'Path to JSON file of HTTP Header key/value pairs to send in requests')
55
55
  .example(
56
- 'lighthouse <url> --only-categories=performance,pwa',
57
- 'Only run the specified categories. Available categories: accessibility, best-practices, performance, pwa, seo')
56
+ 'lighthouse <url> --only-categories=performance,seo',
57
+ 'Only run the specified categories. Available categories: accessibility, best-practices, performance, seo')
58
58
 
59
59
  // We only have the single string positional argument, the url.
60
60
  .option('_', {
@@ -188,7 +188,7 @@ function getYargsParser(manualArgv) {
188
188
  array: true,
189
189
  type: 'string',
190
190
  coerce: splitCommaSeparatedValues,
191
- describe: 'Only run the specified categories. Available categories: accessibility, best-practices, performance, pwa, seo',
191
+ describe: 'Only run the specified categories. Available categories: accessibility, best-practices, performance, seo',
192
192
  },
193
193
  'skip-audits': {
194
194
  array: true,
@@ -32,9 +32,6 @@ import metricsDelayedFcp from './test-definitions/metrics-delayed-fcp.js';
32
32
  import metricsDelayedLcp from './test-definitions/metrics-delayed-lcp.js';
33
33
  import metricsTrickyTti from './test-definitions/metrics-tricky-tti.js';
34
34
  import metricsTrickyTtiLateFcp from './test-definitions/metrics-tricky-tti-late-fcp.js';
35
- import offlineOnlineOnly from './test-definitions/offline-online-only.js';
36
- import offlineReady from './test-definitions/offline-ready.js';
37
- import offlineSwBroken from './test-definitions/offline-sw-broken.js';
38
35
  import oopifRequests from './test-definitions/oopif-requests.js';
39
36
  import oopifScripts from './test-definitions/oopif-scripts.js';
40
37
  import perfBudgets from './test-definitions/perf-budgets.js';
@@ -46,11 +43,6 @@ import perfFonts from './test-definitions/perf-fonts.js';
46
43
  import perfFrameMetrics from './test-definitions/perf-frame-metrics.js';
47
44
  import perfPreload from './test-definitions/perf-preload.js';
48
45
  import perfTraceElements from './test-definitions/perf-trace-elements.js';
49
- import pwaAirhorner from './test-definitions/pwa-airhorner.js';
50
- import pwaCaltrain from './test-definitions/pwa-caltrain.js';
51
- import pwaChromestatus from './test-definitions/pwa-chromestatus.js';
52
- import pwaRocks from './test-definitions/pwa-rocks.js';
53
- import pwaSvgomg from './test-definitions/pwa-svgomg.js';
54
46
  import redirectsClientPaintServer from './test-definitions/redirects-client-paint-server.js';
55
47
  import redirectsHistoryPushState from './test-definitions/redirects-history-push-state.js';
56
48
  import redirectsHttp from './test-definitions/redirects-http.js';
@@ -98,9 +90,6 @@ const smokeTests = [
98
90
  metricsDelayedLcp,
99
91
  metricsTrickyTti,
100
92
  metricsTrickyTtiLateFcp,
101
- offlineOnlineOnly,
102
- offlineReady,
103
- offlineSwBroken,
104
93
  oopifRequests,
105
94
  oopifScripts,
106
95
  perfBudgets,
@@ -112,11 +101,6 @@ const smokeTests = [
112
101
  perfFrameMetrics,
113
102
  perfPreload,
114
103
  perfTraceElements,
115
- pwaAirhorner,
116
- pwaCaltrain,
117
- pwaChromestatus,
118
- pwaRocks,
119
- pwaSvgomg,
120
104
  redirectsClientPaintServer,
121
105
  redirectsHistoryPushState,
122
106
  redirectsHttp,
@@ -59,7 +59,7 @@ function getDefinitionsToRun(allTestDefns, requestedIds, excludedTests) {
59
59
  } else {
60
60
  smokes = allTestDefns.filter(test => {
61
61
  // Include all tests that *include* requested id.
62
- // e.g. a requested 'pwa' will match 'pwa-airhorner', 'pwa-caltrain', etc
62
+ // e.g. a requested 'perf' will match 'perf-preload', 'perf-trace-elements', etc
63
63
  return requestedIds.some(requestedId => test.id.includes(requestedId));
64
64
  });
65
65
  console.log(`Running ONLY smoketests for: ${smokes.map(t => t.id).join(' ')}\n`);
@@ -125,7 +125,7 @@ async function begin() {
125
125
  const rawArgv = y
126
126
  .help('help')
127
127
  .usage('node $0 [<options>] <test-ids>')
128
- .example('node $0 -j=1 pwa seo', 'run pwa and seo tests serially')
128
+ .example('node $0 -j=1 perf seo', 'run perf and seo tests serially')
129
129
  .option('_', {
130
130
  array: true,
131
131
  type: 'string',
@@ -90,15 +90,6 @@ const UIStrings = {
90
90
  seoCrawlingGroupTitle: 'Crawling and Indexing',
91
91
  /** 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. */
92
92
  seoCrawlingGroupDescription: 'To appear in search results, crawlers need access to your app.',
93
- /** 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. */
94
- pwaCategoryTitle: 'PWA',
95
- /** 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. The last sentence starting with 'Learn' becomes link text to additional documentation. */
96
- pwaCategoryDescription: 'These checks validate the aspects of a Progressive Web App. ' +
97
- '[Learn what makes a good Progressive Web App](https://web.dev/articles/pwa-checklist).',
98
- /** Description of the Progressive Web Application (PWA) manual checks category, containing a list of additional validators must be run by hand in order to check all PWA best practices. This is displayed at the top of a list of manually run 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. */
99
- pwaCategoryManualDescription: 'These checks are required by the baseline ' +
100
- '[PWA Checklist](https://web.dev/articles/pwa-checklist) but are ' +
101
- 'not automatically checked by Lighthouse. They do not affect your score but it\'s important that you verify them manually.',
102
93
  /** Title of the Best Practices category of audits. This is displayed at the top of a list of audits focused on topics related to following web development best practices and accepted guidelines. Also used as a label of a score gauge; try to limit to 20 characters. */
103
94
  bestPracticesCategoryTitle: 'Best Practices',
104
95
  /** Title of the Trust & Safety group of audits. This is displayed at the top of a list of audits focused on maintaining user trust and protecting security in web development. */
@@ -109,10 +100,6 @@ const UIStrings = {
109
100
  bestPracticesBrowserCompatGroupTitle: 'Browser Compatibility',
110
101
  /** Title of the General group of the Best Practices category. Within this section are the audits that don't belong to a specific group but are of general interest. */
111
102
  bestPracticesGeneralGroupTitle: 'General',
112
- /** Title of the Installable section of the web app category. Within this section are audits that check if Chrome supports installing the web site as an app on their device. */
113
- pwaInstallableGroupTitle: 'Installable',
114
- /** Title of the "PWA Optimized" section of the web app category. Within this section are audits that check if the developer has taken advantage of features to make their web page more enjoyable and engaging for the user. */
115
- pwaOptimizedGroupTitle: 'PWA Optimized',
116
103
  };
117
104
 
118
105
  const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
@@ -137,7 +124,6 @@ const defaultConfig = {
137
124
  {id: 'Inputs', gatherer: 'inputs'},
138
125
  {id: 'IFrameElements', gatherer: 'iframe-elements'},
139
126
  {id: 'ImageElements', gatherer: 'image-elements'},
140
- {id: 'InstallabilityErrors', gatherer: 'installability-errors'},
141
127
  {id: 'InspectorIssues', gatherer: 'inspector-issues'},
142
128
  {id: 'JsUsage', gatherer: 'js-usage'},
143
129
  {id: 'LinkElements', gatherer: 'link-elements'},
@@ -154,7 +140,6 @@ const defaultConfig = {
154
140
  {id: 'TagsBlockingFirstPaint', gatherer: 'dobetterweb/tags-blocking-first-paint'},
155
141
  {id: 'TraceElements', gatherer: 'trace-elements'},
156
142
  {id: 'ViewportDimensions', gatherer: 'viewport-dimensions'},
157
- {id: 'WebAppManifest', gatherer: 'web-app-manifest'},
158
143
 
159
144
  // Artifact copies are renamed for compatibility with legacy artifacts.
160
145
  {id: 'devtoolsLogs', gatherer: 'devtools-log-compat'},
@@ -186,11 +171,6 @@ const defaultConfig = {
186
171
  'user-timings',
187
172
  'critical-request-chains',
188
173
  'redirects',
189
- 'installable-manifest',
190
- 'splash-screen',
191
- 'themed-omnibox',
192
- 'maskable-icon',
193
- 'content-width',
194
174
  'image-aspect-ratio',
195
175
  'image-size-responsive',
196
176
  'deprecations',
@@ -220,9 +200,6 @@ const defaultConfig = {
220
200
  'prioritize-lcp-image',
221
201
  'csp-xss',
222
202
  'script-treemap-data',
223
- 'manual/pwa-cross-browser',
224
- 'manual/pwa-page-transitions',
225
- 'manual/pwa-each-page-has-url',
226
203
  'accessibility/accesskeys',
227
204
  'accessibility/aria-allowed-attr',
228
205
  'accessibility/aria-allowed-role',
@@ -345,12 +322,6 @@ const defaultConfig = {
345
322
  title: str_(UIStrings.diagnosticsGroupTitle),
346
323
  description: str_(UIStrings.diagnosticsGroupDescription),
347
324
  },
348
- 'pwa-installable': {
349
- title: str_(UIStrings.pwaInstallableGroupTitle),
350
- },
351
- 'pwa-optimized': {
352
- title: str_(UIStrings.pwaOptimizedGroupTitle),
353
- },
354
325
  'a11y-best-practices': {
355
326
  title: str_(UIStrings.a11yBestPracticesGroupTitle),
356
327
  description: str_(UIStrings.a11yBestPracticesGroupDescription),
@@ -603,12 +574,17 @@ const defaultConfig = {
603
574
  manualDescription: str_(UIStrings.seoCategoryManualDescription),
604
575
  supportedModes: ['navigation', 'snapshot'],
605
576
  auditRefs: [
577
+ // Should be at least 31% of the score, such that this audit failing
578
+ // results in the SEO category failing.
579
+ // Solve for w:
580
+ // w / (w + T) >= 0.31
581
+ // where T is the sum of all the other weights.
582
+ {id: 'is-crawlable', weight: 93 / 23, group: 'seo-crawl'},
606
583
  {id: 'document-title', weight: 1, group: 'seo-content'},
607
584
  {id: 'meta-description', weight: 1, group: 'seo-content'},
608
585
  {id: 'http-status-code', weight: 1, group: 'seo-crawl'},
609
586
  {id: 'link-text', weight: 1, group: 'seo-content'},
610
587
  {id: 'crawlable-anchors', weight: 1, group: 'seo-crawl'},
611
- {id: 'is-crawlable', weight: 1, group: 'seo-crawl'},
612
588
  {id: 'robots-txt', weight: 1, group: 'seo-crawl'},
613
589
  {id: 'image-alt', weight: 1, group: 'seo-content'},
614
590
  {id: 'hreflang', weight: 1, group: 'seo-content'},
@@ -617,26 +593,6 @@ const defaultConfig = {
617
593
  {id: 'structured-data', weight: 0},
618
594
  ],
619
595
  },
620
- 'pwa': {
621
- title: str_(UIStrings.pwaCategoryTitle),
622
- description: str_(UIStrings.pwaCategoryDescription),
623
- manualDescription: str_(UIStrings.pwaCategoryManualDescription),
624
- supportedModes: ['navigation'],
625
- auditRefs: [
626
- // Installable
627
- {id: 'installable-manifest', weight: 2, group: 'pwa-installable'},
628
- // PWA Optimized
629
- {id: 'splash-screen', weight: 1, group: 'pwa-optimized'},
630
- {id: 'themed-omnibox', weight: 1, group: 'pwa-optimized'},
631
- {id: 'content-width', weight: 1, group: 'pwa-optimized'},
632
- {id: 'viewport', weight: 2, group: 'pwa-optimized'},
633
- {id: 'maskable-icon', weight: 1, group: 'pwa-optimized'},
634
- // Manual audits
635
- {id: 'pwa-cross-browser', weight: 0},
636
- {id: 'pwa-page-transitions', weight: 0},
637
- {id: 'pwa-each-page-has-url', weight: 0},
638
- ],
639
- },
640
596
  },
641
597
  };
642
598
 
@@ -7,8 +7,32 @@
7
7
  import * as Lantern from './types/lantern.js';
8
8
  import {NetworkRequestTypes} from './lantern.js';
9
9
  import {BaseNode} from './base-node.js';
10
- // TODO(15841): bring impl of isNonNetworkRequest inside lantern and remove this.
11
- import UrlUtils from '../url-utils.js';
10
+
11
+ const NON_NETWORK_SCHEMES = [
12
+ 'blob', // @see https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
13
+ 'data', // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
14
+ 'intent', // @see https://developer.chrome.com/docs/multidevice/android/intents/
15
+ 'file', // @see https://en.wikipedia.org/wiki/File_URI_scheme
16
+ 'filesystem', // @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystem
17
+ 'chrome-extension',
18
+ ];
19
+
20
+ /**
21
+ * Use `NetworkRequest.isNonNetworkRequest(req)` if working with a request.
22
+ * Note: the `protocol` field from CDP can be 'h2', 'http', (not 'https'!) or it'll be url's scheme.
23
+ * https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/protocol/network_handler.cc;l=598-611;drc=56d4a9a9deb30be73adcee8737c73bcb2a5ab64f
24
+ * However, a `new URL(href).protocol` has a colon suffix.
25
+ * https://url.spec.whatwg.org/#dom-url-protocol
26
+ * A URL's `scheme` is specced as the `protocol` sans-colon, but isn't exposed on a URL object.
27
+ * This method can take all 3 of these string types as a parameter.
28
+ * @param {string} protocol Either a networkRequest's `protocol` per CDP or a `new URL(href).protocol`
29
+ * @return {boolean}
30
+ */
31
+ function isNonNetworkProtocol(protocol) {
32
+ // Strip off any colon
33
+ const urlScheme = protocol.includes(':') ? protocol.slice(0, protocol.indexOf(':')) : protocol;
34
+ return NON_NETWORK_SCHEMES.includes(urlScheme);
35
+ }
12
36
 
13
37
  /**
14
38
  * @template [T=any]
@@ -75,9 +99,9 @@ class NetworkNode extends BaseNode {
75
99
  */
76
100
  get isNonNetworkProtocol() {
77
101
  // The 'protocol' field in devtools a string more like a `scheme`
78
- return UrlUtils.isNonNetworkProtocol(this.request.protocol) ||
102
+ return isNonNetworkProtocol(this.request.protocol) ||
79
103
  // But `protocol` can fail to be populated if the request fails, so fallback to scheme.
80
- UrlUtils.isNonNetworkProtocol(this.request.parsedURL.scheme);
104
+ isNonNetworkProtocol(this.request.parsedURL.scheme);
81
105
  }
82
106
 
83
107
  /**