lighthouse 9.5.0-dev.20220327 → 9.5.0-dev.20220330
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/dist/report/bundle.esm.js +20 -18
- package/dist/report/flow.js +1 -1
- package/dist/report/standalone.js +1 -1
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +26 -18
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +2 -2
- package/lighthouse-core/audits/byte-efficiency/duplicated-javascript.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/efficient-animated-content.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +15 -16
- package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +3 -2
- package/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +2 -2
- package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/uses-text-compression.js +1 -1
- package/lighthouse-core/audits/dobetterweb/uses-http2.js +2 -1
- package/lighthouse-core/audits/long-tasks.js +3 -2
- package/lighthouse-core/audits/metrics/first-contentful-paint-3g.js +2 -2
- package/lighthouse-core/audits/metrics/first-contentful-paint.js +3 -2
- package/lighthouse-core/audits/metrics/first-meaningful-paint.js +3 -2
- package/lighthouse-core/audits/metrics/interactive.js +3 -2
- package/lighthouse-core/audits/metrics/largest-contentful-paint.js +3 -2
- package/lighthouse-core/audits/metrics/max-potential-fid.js +3 -2
- package/lighthouse-core/audits/metrics/speed-index.js +3 -2
- package/lighthouse-core/audits/metrics/total-blocking-time.js +3 -2
- package/lighthouse-core/audits/metrics.js +3 -2
- package/lighthouse-core/audits/predictive-perf.js +2 -1
- package/lighthouse-core/audits/preload-lcp-image.js +1 -1
- package/lighthouse-core/audits/redirects.js +1 -1
- package/lighthouse-core/audits/timing-budget.js +3 -2
- package/lighthouse-core/audits/uses-rel-preconnect.js +1 -1
- package/lighthouse-core/audits/uses-rel-preload.js +1 -1
- package/lighthouse-core/computed/critical-request-chains.js +2 -9
- package/lighthouse-core/computed/main-resource.js +1 -1
- package/lighthouse-core/computed/metrics/first-contentful-paint-all-frames.js +1 -1
- package/lighthouse-core/computed/metrics/first-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/first-meaningful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/interactive.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-interactive.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-max-potential-fid.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-metric.js +3 -5
- package/lighthouse-core/computed/metrics/lantern-speed-index.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +1 -1
- package/lighthouse-core/computed/metrics/largest-contentful-paint-all-frames.js +1 -1
- package/lighthouse-core/computed/metrics/largest-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/max-potential-fid.js +1 -1
- package/lighthouse-core/computed/metrics/metric.js +1 -0
- package/lighthouse-core/computed/metrics/speed-index.js +1 -1
- package/lighthouse-core/computed/metrics/timing-summary.js +13 -6
- package/lighthouse-core/computed/metrics/total-blocking-time.js +1 -1
- package/lighthouse-core/computed/page-dependency-graph.js +54 -31
- package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +8 -1
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +32 -22
- package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +6 -2
- package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +8 -4
- package/lighthouse-core/gather/driver/execution-context.js +4 -2
- package/lighthouse-core/gather/driver/navigation.js +9 -9
- package/lighthouse-core/gather/driver/network-monitor.js +16 -3
- package/lighthouse-core/gather/driver.js +5 -0
- package/lighthouse-core/gather/gather-runner.js +13 -7
- package/lighthouse-core/gather/gatherers/js-usage.js +7 -6
- package/lighthouse-core/gather/gatherers/scripts.js +20 -2
- package/lighthouse-core/lib/dependency-graph/simulator/network-analyzer.js +8 -29
- package/lighthouse-core/lib/navigation-error.js +13 -4
- package/lighthouse-core/util-commonjs.js +20 -18
- package/package.json +1 -1
- package/report/renderer/util.js +20 -18
- package/types/artifacts.d.ts +25 -2
- package/types/gatherer.d.ts +1 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const LHError = require('./lh-error.js');
|
|
9
9
|
const NetworkAnalyzer = require('./dependency-graph/simulator/network-analyzer.js');
|
|
10
|
+
const NetworkRequest = require('./network-request.js');
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Returns an error if the original network request failed or wasn't found.
|
|
@@ -100,10 +101,18 @@ function getNonHtmlError(finalRecord) {
|
|
|
100
101
|
function getPageLoadError(navigationError, context) {
|
|
101
102
|
const {url, loadFailureMode, networkRecords} = context;
|
|
102
103
|
/** @type {LH.Artifacts.NetworkRequest|undefined} */
|
|
103
|
-
let mainRecord;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
let mainRecord = NetworkAnalyzer.findResourceForUrl(networkRecords, url);
|
|
105
|
+
|
|
106
|
+
// If the url doesn't give us a network request, it's possible we landed on a chrome-error:// page
|
|
107
|
+
// In this case, just get the first document request.
|
|
108
|
+
if (!mainRecord) {
|
|
109
|
+
const documentRequests = networkRecords.filter(record =>
|
|
110
|
+
record.resourceType === NetworkRequest.TYPES.Document
|
|
111
|
+
);
|
|
112
|
+
if (documentRequests.length) {
|
|
113
|
+
mainRecord = documentRequests.reduce((min, r) => (r.startTime < min.startTime ? r : min));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
107
116
|
|
|
108
117
|
// MIME Type is only set on the final redirected document request. Use this for the HTML check instead of root.
|
|
109
118
|
let finalRecord;
|
|
@@ -318,24 +318,26 @@ class Util {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
const MAX_LENGTH = 64;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
321
|
+
if (parsedUrl.protocol !== 'data:') {
|
|
322
|
+
// Always elide hexadecimal hash
|
|
323
|
+
name = name.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, `$1${ELLIPSIS}`);
|
|
324
|
+
// Also elide other hash-like mixed-case strings
|
|
325
|
+
name = name.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,
|
|
326
|
+
`$1${ELLIPSIS}`);
|
|
327
|
+
// Also elide long number sequences
|
|
328
|
+
name = name.replace(/(\d{3})\d{6,}/g, `$1${ELLIPSIS}`);
|
|
329
|
+
// Merge any adjacent ellipses
|
|
330
|
+
name = name.replace(/\u2026+/g, ELLIPSIS);
|
|
331
|
+
|
|
332
|
+
// Elide query params first
|
|
333
|
+
if (name.length > MAX_LENGTH && name.includes('?')) {
|
|
334
|
+
// Try to leave the first query parameter intact
|
|
335
|
+
name = name.replace(/\?([^=]*)(=)?.*/, `?$1$2${ELLIPSIS}`);
|
|
336
|
+
|
|
337
|
+
// Remove it all if it's still too long
|
|
338
|
+
if (name.length > MAX_LENGTH) {
|
|
339
|
+
name = name.replace(/\?.*/, `?${ELLIPSIS}`);
|
|
340
|
+
}
|
|
339
341
|
}
|
|
340
342
|
}
|
|
341
343
|
|
package/package.json
CHANGED
package/report/renderer/util.js
CHANGED
|
@@ -315,24 +315,26 @@ class Util {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
const MAX_LENGTH = 64;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
318
|
+
if (parsedUrl.protocol !== 'data:') {
|
|
319
|
+
// Always elide hexadecimal hash
|
|
320
|
+
name = name.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, `$1${ELLIPSIS}`);
|
|
321
|
+
// Also elide other hash-like mixed-case strings
|
|
322
|
+
name = name.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,
|
|
323
|
+
`$1${ELLIPSIS}`);
|
|
324
|
+
// Also elide long number sequences
|
|
325
|
+
name = name.replace(/(\d{3})\d{6,}/g, `$1${ELLIPSIS}`);
|
|
326
|
+
// Merge any adjacent ellipses
|
|
327
|
+
name = name.replace(/\u2026+/g, ELLIPSIS);
|
|
328
|
+
|
|
329
|
+
// Elide query params first
|
|
330
|
+
if (name.length > MAX_LENGTH && name.includes('?')) {
|
|
331
|
+
// Try to leave the first query parameter intact
|
|
332
|
+
name = name.replace(/\?([^=]*)(=)?.*/, `?$1$2${ELLIPSIS}`);
|
|
333
|
+
|
|
334
|
+
// Remove it all if it's still too long
|
|
335
|
+
if (name.length > MAX_LENGTH) {
|
|
336
|
+
name = name.replace(/\?.*/, `?${ELLIPSIS}`);
|
|
337
|
+
}
|
|
336
338
|
}
|
|
337
339
|
}
|
|
338
340
|
|
package/types/artifacts.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ interface UniversalBaseArtifacts {
|
|
|
66
66
|
*/
|
|
67
67
|
interface ContextualBaseArtifacts {
|
|
68
68
|
/** The URL initially requested and the post-redirects URL that was actually loaded. */
|
|
69
|
-
URL:
|
|
69
|
+
URL: Artifacts.URL;
|
|
70
70
|
/** If loading the page failed, value is the error that caused it. Otherwise null. */
|
|
71
71
|
PageLoadError: LighthouseError | null;
|
|
72
72
|
}
|
|
@@ -187,6 +187,28 @@ declare module Artifacts {
|
|
|
187
187
|
type TaskNode = _TaskNode;
|
|
188
188
|
type MetaElement = Artifacts['MetaElements'][0];
|
|
189
189
|
|
|
190
|
+
interface URL {
|
|
191
|
+
/** URL of the main frame before Lighthouse starts. */
|
|
192
|
+
initialUrl: string;
|
|
193
|
+
/**
|
|
194
|
+
* URL of the first document request during a Lighthouse navigation.
|
|
195
|
+
* Will be the same as `initialUrl` in timespan/snapshot.
|
|
196
|
+
* TODO: Make this property `undefined` in timespan/snapshot.
|
|
197
|
+
*/
|
|
198
|
+
requestedUrl: string;
|
|
199
|
+
/**
|
|
200
|
+
* URL of the last document request during a Lighthouse navigation.
|
|
201
|
+
* Will be `undefined` in timespan/snapshot.
|
|
202
|
+
*/
|
|
203
|
+
mainDocumentUrl?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Will be the same as `mainDocumentUrl` in navigation mode.
|
|
206
|
+
* Wil be the URL of the main frame after Lighthouse finishes in timespan/snapshot.
|
|
207
|
+
* TODO: Use the main frame URL in navigation mode as well.
|
|
208
|
+
*/
|
|
209
|
+
finalUrl: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
190
212
|
interface NodeDetails {
|
|
191
213
|
lhId: string,
|
|
192
214
|
devtoolsNodePath: string,
|
|
@@ -299,7 +321,7 @@ declare module Artifacts {
|
|
|
299
321
|
url: string;
|
|
300
322
|
content?: string;
|
|
301
323
|
}
|
|
302
|
-
|
|
324
|
+
|
|
303
325
|
interface ScriptElement {
|
|
304
326
|
type: string | null
|
|
305
327
|
src: string | null
|
|
@@ -619,6 +641,7 @@ declare module Artifacts {
|
|
|
619
641
|
settings: Immutable<Config.Settings>;
|
|
620
642
|
gatherContext: Artifacts['GatherContext'];
|
|
621
643
|
simulator?: InstanceType<typeof LanternSimulator>;
|
|
644
|
+
URL: Artifacts['URL'];
|
|
622
645
|
}
|
|
623
646
|
|
|
624
647
|
interface MetricComputationData extends MetricComputationDataInput {
|
package/types/gatherer.d.ts
CHANGED