lighthouse 9.1.0-dev.20211214 → 9.2.0-dev.20211217

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/changelog.md CHANGED
@@ -1,3 +1,50 @@
1
+ <a name="9.2.0"></a>
2
+ # 9.2.0 (2021-12-15)
3
+ [Full Changelog](https://github.com/GoogleChrome/lighthouse/compare/v9.1.0...v9.2.0)
4
+
5
+ We expect this release to ship in the DevTools of [Chrome 99](https://chromiumdash.appspot.com/schedule), and to PageSpeed Insights within 2 weeks.
6
+
7
+ ## Notable Changes
8
+
9
+ * move no-unload-listeners to perf category ([#13497](https://github.com/GoogleChrome/lighthouse/pull/13497))
10
+
11
+ ## Core
12
+
13
+ * font-size: fix CSS selector regex ([#13455](https://github.com/GoogleChrome/lighthouse/pull/13455))
14
+ * fcp: handle negative request `endTime` ([#13452](https://github.com/GoogleChrome/lighthouse/pull/13452))
15
+ * legacy-javascript: update polyfilling, drop some signals ([#13482](https://github.com/GoogleChrome/lighthouse/pull/13482), [#13442](https://github.com/GoogleChrome/lighthouse/pull/13442))
16
+ * cache fetch to avoid bad polyfills ([#13476](https://github.com/GoogleChrome/lighthouse/pull/13476))
17
+ * check equality of computed artifacts using dependency keys ([#13430](https://github.com/GoogleChrome/lighthouse/pull/13430))
18
+
19
+ ## ⛏️👷 Fraggle Rock
20
+
21
+ Support for auditing user flows ([#11313](https://github.com/GoogleChrome/lighthouse/issues/11313))
22
+
23
+ * compute timespan saving with observed throughput ([#13478](https://github.com/GoogleChrome/lighthouse/pull/13478))
24
+ * option to skip about:blank jumps ([#13375](https://github.com/GoogleChrome/lighthouse/pull/13375))
25
+
26
+ ## Report
27
+
28
+ * psi: update styles for tighter fit in narrow viewports ([#13355](https://github.com/GoogleChrome/lighthouse/pull/13355))
29
+
30
+ ## Deps
31
+
32
+ * bump eslint and related items ([#13484](https://github.com/GoogleChrome/lighthouse/pull/13484))
33
+ * axe-core: upgrade to 4.3.5 ([#13441](https://github.com/GoogleChrome/lighthouse/pull/13441))
34
+
35
+ ## Tests
36
+
37
+ * smoke: fix chromestatus url ([#13475](https://github.com/GoogleChrome/lighthouse/pull/13475))
38
+ * split smoke tests into one test per file ([#13461](https://github.com/GoogleChrome/lighthouse/pull/13461))
39
+ * fix devtools build command ([#13457](https://github.com/GoogleChrome/lighthouse/pull/13457))
40
+ * move sharding higher so smokehouse-bundle can also shard ([#13387](https://github.com/GoogleChrome/lighthouse/pull/13387))
41
+ * port axe test to pptr ([#13450](https://github.com/GoogleChrome/lighthouse/pull/13450))
42
+
43
+ ## Misc
44
+
45
+ * build: build test flow report to same path as sample-reports ([#13324](https://github.com/GoogleChrome/lighthouse/pull/13324))
46
+ * treemap: add `lang` to html tag ([#13454](https://github.com/GoogleChrome/lighthouse/pull/13454))
47
+
1
48
  <a name="9.1.0"></a>
2
49
  # 9.1.0 (2021-11-24)
3
50
  [Full Changelog](https://github.com/GoogleChrome/lighthouse/compare/v9.0.0...v9.1.0)
@@ -6,7 +53,7 @@ We expect this release to ship in the DevTools of [Chrome 98](https://chromiumda
6
53
 
7
54
  ## New Contributors
8
55
 
9
- Thanks to our new contributors 👽🐷🐰🐯🐻!
56
+ Thanks to our new contributors 👽🐷🐰🐯🐻!
10
57
 
11
58
  - @whitep4nth3r
12
59
  - Adam Read @adamread
@@ -78,7 +125,7 @@ See the [What's new in Lighthouse 9.0 blog post](https://developer.chrome.com/bl
78
125
 
79
126
  ## New Contributors
80
127
 
81
- Thanks to our new contributors 👽🐷🐰🐯🐻!
128
+ Thanks to our new contributors 👽🐷🐰🐯🐻!
82
129
 
83
130
  - Sergii Bondarenko @BR0kEN-
84
131
  - Prerana Nawar @prerana1821
@@ -197,7 +244,7 @@ We expect this release to ship in the DevTools of [Chrome 97](https://chromiumda
197
244
 
198
245
  ## New Contributors
199
246
 
200
- Thanks to our new contributors 👽🐷🐰🐯🐻!
247
+ Thanks to our new contributors 👽🐷🐰🐯🐻!
201
248
 
202
249
  - meehawk @meehawk
203
250
  - Edwin Gustafson @edwingustafson
@@ -200,19 +200,6 @@ class UnusedBytes extends Audit {
200
200
  return Math.round(Math.max(savings, 0) / 10) * 10;
201
201
  }
202
202
 
203
- /**
204
- * @param {number} wastedBytes
205
- * @param {Simulator} simulator
206
- */
207
- static computeWastedMsWithThroughput(wastedBytes, simulator) {
208
- const bitsPerSecond = simulator.getOptions().throughput;
209
- // https://github.com/GoogleChrome/lighthouse/pull/13323#issuecomment-962031709
210
- if (bitsPerSecond === 0) return 0;
211
- const wastedBits = wastedBytes * 8;
212
- const wastedMs = wastedBits / bitsPerSecond * 1000;
213
- return wastedMs;
214
- }
215
-
216
203
  /**
217
204
  * @param {ByteEfficiencyProduct} result
218
205
  * @param {Node|null} graph
@@ -232,7 +219,7 @@ class UnusedBytes extends Audit {
232
219
  providedWastedBytesByUrl: result.wastedBytesByUrl,
233
220
  });
234
221
  } else {
235
- wastedMs = this.computeWastedMsWithThroughput(wastedBytes, simulator);
222
+ wastedMs = simulator.computeWastedMsFromWastedBytes(wastedBytes);
236
223
  }
237
224
 
238
225
  let displayValue = result.displayValue || '';
@@ -24,6 +24,7 @@ class LoadSimulator {
24
24
  const options = {
25
25
  additionalRttByOrigin: networkAnalysis.additionalRttByOrigin,
26
26
  serverResponseTimeByOrigin: networkAnalysis.serverResponseTimeByOrigin,
27
+ observedThroughput: networkAnalysis.throughput,
27
28
  };
28
29
 
29
30
  // If we have precomputed lantern data, overwrite our observed estimates and use precomputed instead
@@ -36,25 +36,28 @@ function hasFontSizeDeclaration(style) {
36
36
 
37
37
  /**
38
38
  * Computes the CSS specificity of a given selector, i.e. #id > .class > div
39
+ * TODO: Handle pseudo selectors (:not(), :where, :nth-child) and attribute selectors
39
40
  * LIMITATION: !important is not respected
40
41
  *
41
42
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
42
43
  * @see https://www.smashingmagazine.com/2010/04/css-specificity-and-inheritance/
44
+ * @see https://drafts.csswg.org/selectors-4/#specificity-rules
43
45
  *
44
46
  * @param {string} selector
45
47
  * @return {number}
46
48
  */
47
49
  function computeSelectorSpecificity(selector) {
48
- const tokens = selector.split(' ');
50
+ // Remove universal selector and separator characters, then split.
51
+ const tokens = selector.replace(/[*\s+>~]/g, ' ').split(' ');
49
52
 
50
53
  let numIDs = 0;
51
54
  let numClasses = 0;
52
55
  let numTypes = 0;
53
56
 
54
57
  for (const token of tokens) {
55
- const ids = token.match(/\b#[a-z0-9]+/g) || [];
56
- const classes = token.match(/\b\.[a-z0-9]+/g) || [];
57
- const types = token.match(/^[a-z]+/) ? [1] : [];
58
+ const ids = token.match(/(\b|^)#[a-z0-9_-]+/gi) || [];
59
+ const classes = token.match(/(\b|^)\.[a-z0-9_-]+/gi) || [];
60
+ const types = token.match(/^[a-z]+/i) ? [1] : [];
58
61
  numIDs += ids.length;
59
62
  numClasses += classes.length;
60
63
  numTypes += types.length;
@@ -486,6 +486,23 @@ class Simulator {
486
486
  };
487
487
  }
488
488
 
489
+ /**
490
+ * @param {number} wastedBytes
491
+ */
492
+ computeWastedMsFromWastedBytes(wastedBytes) {
493
+ const {throughput, observedThroughput} = this._options;
494
+
495
+ // https://github.com/GoogleChrome/lighthouse/pull/13323#issuecomment-962031709
496
+ // 0 throughput means the no (additional) throttling is expected.
497
+ // This is common for desktop + devtools throttling where throttling is additive and we don't want any additional.
498
+ const bitsPerSecond = throughput === 0 ? observedThroughput : throughput;
499
+ if (bitsPerSecond === 0) return 0;
500
+
501
+ const wastedBits = wastedBytes * 8;
502
+ const wastedMs = wastedBits / bitsPerSecond * 1000;
503
+ return wastedMs;
504
+ }
505
+
489
506
  /** @return {Map<string, LH.Gatherer.Simulation.Result['nodeTimings']>} */
490
507
  static get ALL_NODE_TIMINGS() {
491
508
  return ALL_SIMULATION_NODE_TIMINGS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "9.1.0-dev.20211214",
3
+ "version": "9.2.0-dev.20211217",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -36,6 +36,7 @@ describe('issueAdded types', () => {
36
36
  Array [
37
37
  "attributionReportingIssueDetails",
38
38
  "blockedByResponseIssueDetails",
39
+ "clientHintIssueDetails",
39
40
  "contentSecurityPolicyIssueDetails",
40
41
  "corsIssueDetails",
41
42
  "deprecationIssueDetails",
@@ -153,6 +153,7 @@ declare module Gatherer {
153
153
  interface Options {
154
154
  rtt?: number;
155
155
  throughput?: number;
156
+ observedThroughput: number;
156
157
  maximumConcurrentRequests?: number;
157
158
  cpuSlowdownMultiplier?: number;
158
159
  layoutTaskMultiplier?: number;