lighthouse 9.5.0-dev.20221128 → 9.5.0-dev.20221129
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/cli/test/smokehouse/lighthouse-runners/devtools.js +1 -1
- package/core/audits/byte-efficiency/offscreen-images.js +1 -1
- package/core/audits/byte-efficiency/render-blocking-resources.js +1 -1
- package/core/audits/critical-request-chains.js +6 -6
- package/core/audits/font-display.js +1 -1
- package/core/audits/network-requests.js +5 -5
- package/core/audits/redirects.js +2 -2
- package/core/audits/uses-rel-preconnect.js +5 -5
- package/core/config/config-helpers.js +12 -3
- package/core/config/default-config.js +1 -0
- package/core/gather/base-gatherer.js +0 -1
- package/core/gather/driver/target-manager.js +12 -5
- package/core/gather/driver.js +1 -1
- package/core/gather/gatherers/bf-cache-failures.js +158 -0
- package/core/gather/gatherers/seo/font-size.js +9 -52
- package/core/legacy/config/legacy-default-config.js +1 -0
- package/core/lib/asset-saver.js +1 -1
- package/core/lib/dependency-graph/base-node.js +2 -0
- package/core/lib/dependency-graph/network-node.js +2 -2
- package/core/lib/dependency-graph/simulator/network-analyzer.js +3 -3
- package/core/lib/dependency-graph/simulator/simulator.js +4 -1
- package/core/lib/network-request.js +16 -11
- package/core/runner.js +0 -1
- package/dist/report/bundle.esm.js +19 -1
- package/dist/report/flow.js +1 -1
- package/dist/report/standalone.js +5 -5
- package/package.json +3 -2
- package/report/renderer/i18n.js +19 -1
- package/types/artifacts.d.ts +12 -0
|
@@ -124,10 +124,14 @@ class NetworkRequest {
|
|
|
124
124
|
this.parsedURL = /** @type {ParsedURL} */ ({scheme: ''});
|
|
125
125
|
this.documentURL = '';
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* When the network service is about to handle a request, ie. just before going to the
|
|
129
|
+
* HTTP cache or going to the network for DNS/connection setup, in milliseconds.
|
|
130
|
+
*/
|
|
127
131
|
this.startTime = -1;
|
|
128
|
-
/**
|
|
132
|
+
/** When the last byte of the response body is received, in milliseconds. */
|
|
129
133
|
this.endTime = -1;
|
|
130
|
-
/**
|
|
134
|
+
/** When the last byte of the response headers is received, in milliseconds. */
|
|
131
135
|
this.responseReceivedTime = -1;
|
|
132
136
|
|
|
133
137
|
// Go read the comment on _updateTransferSizeForLightrider.
|
|
@@ -217,7 +221,8 @@ class NetworkRequest {
|
|
|
217
221
|
};
|
|
218
222
|
this.isSecure = UrlUtils.isSecureScheme(this.parsedURL.scheme);
|
|
219
223
|
|
|
220
|
-
|
|
224
|
+
// Expected to be overriden with better value in `_recomputeTimesWithResourceTiming`.
|
|
225
|
+
this.startTime = data.timestamp * 1000;
|
|
221
226
|
|
|
222
227
|
this.requestMethod = data.request.method;
|
|
223
228
|
|
|
@@ -261,7 +266,7 @@ class NetworkRequest {
|
|
|
261
266
|
if (this.finished) return;
|
|
262
267
|
|
|
263
268
|
this.finished = true;
|
|
264
|
-
this.endTime = data.timestamp;
|
|
269
|
+
this.endTime = data.timestamp * 1000;
|
|
265
270
|
if (data.encodedDataLength >= 0) {
|
|
266
271
|
this.transferSize = data.encodedDataLength;
|
|
267
272
|
}
|
|
@@ -279,7 +284,7 @@ class NetworkRequest {
|
|
|
279
284
|
if (this.finished) return;
|
|
280
285
|
|
|
281
286
|
this.finished = true;
|
|
282
|
-
this.endTime = data.timestamp;
|
|
287
|
+
this.endTime = data.timestamp * 1000;
|
|
283
288
|
|
|
284
289
|
this.failed = true;
|
|
285
290
|
this.resourceType = data.type && RESOURCE_TYPES[data.type];
|
|
@@ -305,7 +310,7 @@ class NetworkRequest {
|
|
|
305
310
|
this._onResponse(data.redirectResponse, data.timestamp, data.type);
|
|
306
311
|
this.resourceType = undefined;
|
|
307
312
|
this.finished = true;
|
|
308
|
-
this.endTime = data.timestamp;
|
|
313
|
+
this.endTime = data.timestamp * 1000;
|
|
309
314
|
|
|
310
315
|
this._updateResponseReceivedTimeIfNecessary();
|
|
311
316
|
}
|
|
@@ -319,7 +324,7 @@ class NetworkRequest {
|
|
|
319
324
|
|
|
320
325
|
/**
|
|
321
326
|
* @param {LH.Crdp.Network.Response} response
|
|
322
|
-
* @param {number} timestamp
|
|
327
|
+
* @param {number} timestamp in seconds
|
|
323
328
|
* @param {LH.Crdp.Network.ResponseReceivedEvent['type']=} resourceType
|
|
324
329
|
*/
|
|
325
330
|
_onResponse(response, timestamp, resourceType) {
|
|
@@ -330,7 +335,7 @@ class NetworkRequest {
|
|
|
330
335
|
|
|
331
336
|
if (response.protocol) this.protocol = response.protocol;
|
|
332
337
|
|
|
333
|
-
this.responseReceivedTime = timestamp;
|
|
338
|
+
this.responseReceivedTime = timestamp * 1000;
|
|
334
339
|
|
|
335
340
|
this.transferSize = response.encodedDataLength;
|
|
336
341
|
if (typeof response.fromDiskCache === 'boolean') this.fromDiskCache = response.fromDiskCache;
|
|
@@ -364,8 +369,8 @@ class NetworkRequest {
|
|
|
364
369
|
// Take startTime and responseReceivedTime from timing data for better accuracy.
|
|
365
370
|
// Timing's requestTime is a baseline in seconds, rest of the numbers there are ticks in millis.
|
|
366
371
|
// TODO: This skips the "queuing time" before the netstack has taken over ... is this a mistake?
|
|
367
|
-
this.startTime = timing.requestTime;
|
|
368
|
-
const headersReceivedTime =
|
|
372
|
+
this.startTime = timing.requestTime * 1000;
|
|
373
|
+
const headersReceivedTime = this.startTime + timing.receiveHeadersEnd;
|
|
369
374
|
if (!this.responseReceivedTime || this.responseReceivedTime < 0) {
|
|
370
375
|
this.responseReceivedTime = headersReceivedTime;
|
|
371
376
|
}
|
|
@@ -478,7 +483,7 @@ class NetworkRequest {
|
|
|
478
483
|
}
|
|
479
484
|
|
|
480
485
|
this.lrStatistics = {
|
|
481
|
-
endTimeDeltaMs:
|
|
486
|
+
endTimeDeltaMs: this.endTime - (this.startTime + totalMs),
|
|
482
487
|
TCPMs: TCPMs,
|
|
483
488
|
requestMs: requestMs,
|
|
484
489
|
responseMs: responseMs,
|
package/core/runner.js
CHANGED
|
@@ -3438,6 +3438,7 @@ class I18n {
|
|
|
3438
3438
|
|
|
3439
3439
|
this._locale = locale;
|
|
3440
3440
|
this._strings = strings;
|
|
3441
|
+
this._cachedNumberFormatters = new Map();
|
|
3441
3442
|
}
|
|
3442
3443
|
|
|
3443
3444
|
get strings() {
|
|
@@ -3472,7 +3473,24 @@ class I18n {
|
|
|
3472
3473
|
number = 0;
|
|
3473
3474
|
}
|
|
3474
3475
|
|
|
3475
|
-
|
|
3476
|
+
let formatter;
|
|
3477
|
+
// eslint-disable-next-line max-len
|
|
3478
|
+
const cacheKey = [
|
|
3479
|
+
opts.minimumFractionDigits,
|
|
3480
|
+
opts.maximumFractionDigits,
|
|
3481
|
+
opts.style,
|
|
3482
|
+
opts.unit,
|
|
3483
|
+
opts.unitDisplay,
|
|
3484
|
+
this._locale,
|
|
3485
|
+
].join('');
|
|
3486
|
+
|
|
3487
|
+
formatter = this._cachedNumberFormatters.get(cacheKey);
|
|
3488
|
+
if (!formatter) {
|
|
3489
|
+
formatter = new Intl.NumberFormat(this._locale, opts);
|
|
3490
|
+
this._cachedNumberFormatters.set(cacheKey, formatter);
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3493
|
+
return formatter.format(number).replace(' ', NBSP2);
|
|
3476
3494
|
}
|
|
3477
3495
|
|
|
3478
3496
|
/**
|
package/dist/report/flow.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
27
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
28
28
|
*/
|
|
29
|
-
const ta=1024,ia=1048576;class oa{constructor(e,a){"en-XA"===e&&(e="de"),this._locale=e,this._strings=a}get strings(){return this._strings}_formatNumberWithGranularity(e,a,n={}){if(void 0!==a){const t=-Math.log10(a);Number.isInteger(t)||(console.warn(`granularity of ${a} is invalid. Using 1 instead`),a=1),a<1&&((n={...n}).minimumFractionDigits=n.maximumFractionDigits=Math.ceil(t)),e=Math.round(e/a)*a,Object.is(e,-0)&&(e=0)}else Math.abs(e)<5e-4&&(e=0);return new Intl.NumberFormat(this._locale,n).format(e).replace(" "," ")}formatNumber(e,a){return this._formatNumberWithGranularity(e,a)}formatInteger(e){return this._formatNumberWithGranularity(e,1)}formatPercent(e){return new Intl.NumberFormat(this._locale,{style:"percent"}).format(e)}formatBytesToKiB(e,a){return this._formatNumberWithGranularity(e/ta,a)+" KiB"}formatBytesToMiB(e,a){return this._formatNumberWithGranularity(e/ia,a)+" MiB"}formatBytes(e,a=1){return this._formatNumberWithGranularity(e,a,{style:"unit",unit:"byte",unitDisplay:"long"})}formatBytesWithBestUnit(e,a){return e>=ia?this.formatBytesToMiB(e,a):e>=ta?this.formatBytesToKiB(e,a):this._formatNumberWithGranularity(e,a,{style:"unit",unit:"byte",unitDisplay:"narrow"})}formatKbps(e,a){return this._formatNumberWithGranularity(e,a,{style:"unit",unit:"kilobit-per-second",unitDisplay:"short"})}formatMilliseconds(e,a){return this._formatNumberWithGranularity(e,a,{style:"unit",unit:"millisecond",unitDisplay:"short"})}formatSeconds(e,a){return this._formatNumberWithGranularity(e/1e3,a,{style:"unit",unit:"second",unitDisplay:"short"})}formatDateTime(e){const a={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"};let n;try{n=new Intl.DateTimeFormat(this._locale,a)}catch(e){a.timeZone="UTC",n=new Intl.DateTimeFormat(this._locale,a)}return n.format(new Date(e))}formatDuration(e){let a=e/1e3;if(0===Math.round(a))return"None";const n=[],t={day:86400,hour:3600,minute:60,second:1};return Object.keys(t).forEach((e=>{const i=t[e],o=Math.floor(a/i);if(o>0){a-=o*i;const t=this._formatNumberWithGranularity(o,1,{style:"unit",unit:e,unitDisplay:"narrow"});n.push(t)}})),n.join(" ")}}
|
|
29
|
+
const ta=1024,ia=1048576;class oa{constructor(e,a){"en-XA"===e&&(e="de"),this._locale=e,this._strings=a,this._cachedNumberFormatters=new Map}get strings(){return this._strings}_formatNumberWithGranularity(e,a,n={}){if(void 0!==a){const t=-Math.log10(a);Number.isInteger(t)||(console.warn(`granularity of ${a} is invalid. Using 1 instead`),a=1),a<1&&((n={...n}).minimumFractionDigits=n.maximumFractionDigits=Math.ceil(t)),e=Math.round(e/a)*a,Object.is(e,-0)&&(e=0)}else Math.abs(e)<5e-4&&(e=0);let t;const i=[n.minimumFractionDigits,n.maximumFractionDigits,n.style,n.unit,n.unitDisplay,this._locale].join("");return t=this._cachedNumberFormatters.get(i),t||(t=new Intl.NumberFormat(this._locale,n),this._cachedNumberFormatters.set(i,t)),t.format(e).replace(" "," ")}formatNumber(e,a){return this._formatNumberWithGranularity(e,a)}formatInteger(e){return this._formatNumberWithGranularity(e,1)}formatPercent(e){return new Intl.NumberFormat(this._locale,{style:"percent"}).format(e)}formatBytesToKiB(e,a){return this._formatNumberWithGranularity(e/ta,a)+" KiB"}formatBytesToMiB(e,a){return this._formatNumberWithGranularity(e/ia,a)+" MiB"}formatBytes(e,a=1){return this._formatNumberWithGranularity(e,a,{style:"unit",unit:"byte",unitDisplay:"long"})}formatBytesWithBestUnit(e,a){return e>=ia?this.formatBytesToMiB(e,a):e>=ta?this.formatBytesToKiB(e,a):this._formatNumberWithGranularity(e,a,{style:"unit",unit:"byte",unitDisplay:"narrow"})}formatKbps(e,a){return this._formatNumberWithGranularity(e,a,{style:"unit",unit:"kilobit-per-second",unitDisplay:"short"})}formatMilliseconds(e,a){return this._formatNumberWithGranularity(e,a,{style:"unit",unit:"millisecond",unitDisplay:"short"})}formatSeconds(e,a){return this._formatNumberWithGranularity(e/1e3,a,{style:"unit",unit:"second",unitDisplay:"short"})}formatDateTime(e){const a={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"};let n;try{n=new Intl.DateTimeFormat(this._locale,a)}catch(e){a.timeZone="UTC",n=new Intl.DateTimeFormat(this._locale,a)}return n.format(new Date(e))}formatDuration(e){let a=e/1e3;if(0===Math.round(a))return"None";const n=[],t={day:86400,hour:3600,minute:60,second:1};return Object.keys(t).forEach((e=>{const i=t[e],o=Math.floor(a/i);if(o>0){a-=o*i;const t=this._formatNumberWithGranularity(o,1,{style:"unit",unit:e,unitDisplay:"narrow"});n.push(t)}})),n.join(" ")}}
|
|
30
30
|
/**
|
|
31
31
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
32
32
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|