lighthouse 13.6.0-dev.20261111 → 13.6.0-dev.20261112
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/open-file.d.ts +7 -0
- package/cli/open-file.js +48 -0
- package/cli/run.js +2 -2
- package/core/gather/driver/execution-context.js +2 -0
- package/core/gather/driver/wait-for-condition.js +5 -3
- package/core/gather/gatherers/css-usage.js +5 -1
- package/core/gather/gatherers/stylesheets.js +9 -1
- package/core/lib/lantern-trace-saver.js +19 -13
- package/core/lib/page-functions.js +2 -1
- package/core/lib/sentry.js +11 -2
- package/core/lib/tracehouse/main-thread-tasks.d.ts +7 -0
- package/core/lib/tracehouse/main-thread-tasks.js +18 -6
- package/dist/report/bundle.esm.js +1 -1
- package/dist/report/flow.js +13 -13
- package/dist/report/standalone.js +1 -1
- package/package.json +8 -9
- package/shared/util.js +10 -2
- package/third-party/ard/README.md +1 -1
- package/third-party/ard/schema-validator.js +42 -2
- package/types/internal/node.d.ts +1 -0
package/cli/open-file.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Opens a file (e.g. the HTML report for `--view`) with the OS default application.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {spawn} from 'child_process';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
|
|
14
|
+
import log from 'lighthouse-logger';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Opens a file with its default application, without waiting for it. Failures are logged, not
|
|
18
|
+
* thrown.
|
|
19
|
+
* @param {string} filePath
|
|
20
|
+
*/
|
|
21
|
+
function openFile(filePath) {
|
|
22
|
+
const absolutePath = path.resolve(filePath);
|
|
23
|
+
|
|
24
|
+
/** @type {import('child_process').SpawnOptions} */
|
|
25
|
+
const options = {stdio: 'ignore', detached: true};
|
|
26
|
+
let command = 'xdg-open';
|
|
27
|
+
let args = [absolutePath];
|
|
28
|
+
if (process.platform === 'darwin') {
|
|
29
|
+
command = 'open';
|
|
30
|
+
} else if (process.platform === 'win32') {
|
|
31
|
+
// explorer.exe (unlike `cmd /c start`) doesn't expand `%VAR%` or treat `&` specially, but it
|
|
32
|
+
// does split unquoted `,` and `=`, which report filenames can contain. Windows paths can't
|
|
33
|
+
// contain `"`, so quoting verbatim is safe.
|
|
34
|
+
command = 'explorer.exe';
|
|
35
|
+
args = [`"${absolutePath}"`];
|
|
36
|
+
options.windowsVerbatimArguments = true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Detached and unref'd so the CLI can exit without waiting for (or killing) the child.
|
|
40
|
+
const child = spawn(command, args, options);
|
|
41
|
+
child.on('error', err => {
|
|
42
|
+
log.warn('CLI', `Unable to open ${absolutePath} with \`${command}\` (${err.message}). ` +
|
|
43
|
+
'Open it manually in your browser.');
|
|
44
|
+
});
|
|
45
|
+
child.unref();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {openFile};
|
package/cli/run.js
CHANGED
|
@@ -13,9 +13,9 @@ import os from 'os';
|
|
|
13
13
|
import * as ChromeLauncher from 'chrome-launcher';
|
|
14
14
|
import yargsParser from 'yargs-parser';
|
|
15
15
|
import log from 'lighthouse-logger';
|
|
16
|
-
import open from 'open';
|
|
17
16
|
|
|
18
17
|
import * as Printer from './printer.js';
|
|
18
|
+
import {openFile} from './open-file.js';
|
|
19
19
|
import lighthouse from '../core/index.js';
|
|
20
20
|
import {getLhrFilenamePrefix} from '../report/generator/file-namer.js';
|
|
21
21
|
import * as assetSaver from '../core/lib/asset-saver.js';
|
|
@@ -272,7 +272,7 @@ async function runLighthouse(urlOrUrls, flags, config) {
|
|
|
272
272
|
if (htmlReportPaths.length > 0) {
|
|
273
273
|
if (flags.view) {
|
|
274
274
|
for (const htmlPath of htmlReportPaths) {
|
|
275
|
-
|
|
275
|
+
openFile(htmlPath);
|
|
276
276
|
}
|
|
277
277
|
} else {
|
|
278
278
|
// eslint-disable-next-line max-len
|
|
@@ -324,6 +324,7 @@ class ExecutionContext {
|
|
|
324
324
|
window.__nativeURL = window.URL;
|
|
325
325
|
window.__nativePerformance = window.performance;
|
|
326
326
|
window.__nativeFetch = window.fetch;
|
|
327
|
+
window.__nativeMap = window.Map;
|
|
327
328
|
window.__ElementMatches = window.Element.prototype.matches;
|
|
328
329
|
window.__HTMLElementBoundingClientRect = window.HTMLElement.prototype.getBoundingClientRect;
|
|
329
330
|
}, {args: []});
|
|
@@ -339,6 +340,7 @@ class ExecutionContext {
|
|
|
339
340
|
'const URL = globalThis.__nativeURL || globalThis.URL',
|
|
340
341
|
'const performance = globalThis.__nativePerformance || globalThis.performance',
|
|
341
342
|
'const fetch = globalThis.__nativeFetch || globalThis.fetch',
|
|
343
|
+
'const Map = globalThis.__nativeMap || globalThis.Map',
|
|
342
344
|
].join(';\n');
|
|
343
345
|
|
|
344
346
|
/**
|
|
@@ -231,9 +231,10 @@ function waitForCPUIdle(session, waitForCPUQuiet) {
|
|
|
231
231
|
/**
|
|
232
232
|
* @param {ExecutionContext} executionContext
|
|
233
233
|
* @param {() => void} resolve
|
|
234
|
+
* @param {(err: Error) => void} reject
|
|
234
235
|
* @return {Promise<void>}
|
|
235
236
|
*/
|
|
236
|
-
async function checkForQuiet(executionContext, resolve) {
|
|
237
|
+
async function checkForQuiet(executionContext, resolve, reject) {
|
|
237
238
|
if (canceled) return;
|
|
238
239
|
const timeSinceLongTask =
|
|
239
240
|
await executionContext.evaluate(
|
|
@@ -247,7 +248,8 @@ function waitForCPUIdle(session, waitForCPUQuiet) {
|
|
|
247
248
|
} else {
|
|
248
249
|
log.verbose('waitFor', `CPU has been idle for ${timeSinceLongTask} ms`);
|
|
249
250
|
const timeToWait = waitForCPUQuiet - timeSinceLongTask;
|
|
250
|
-
lastTimeout = setTimeout(
|
|
251
|
+
lastTimeout = setTimeout(
|
|
252
|
+
() => checkForQuiet(executionContext, resolve, reject).catch(reject), timeToWait);
|
|
251
253
|
}
|
|
252
254
|
}
|
|
253
255
|
}
|
|
@@ -261,7 +263,7 @@ function waitForCPUIdle(session, waitForCPUQuiet) {
|
|
|
261
263
|
/** @type {Promise<void>} */
|
|
262
264
|
const promise = new Promise((resolve, reject) => {
|
|
263
265
|
executionContext.evaluate(registerPerformanceObserverInPage, {args: [], useIsolation: true})
|
|
264
|
-
.then(() => checkForQuiet(executionContext, resolve))
|
|
266
|
+
.then(() => checkForQuiet(executionContext, resolve, reject))
|
|
265
267
|
.catch(reject);
|
|
266
268
|
cancel = () => {
|
|
267
269
|
if (canceled) return;
|
|
@@ -30,7 +30,11 @@ class CSSUsage extends BaseGatherer {
|
|
|
30
30
|
|
|
31
31
|
// Force style to recompute.
|
|
32
32
|
// Doesn't appear to be necessary in newer versions of Chrome.
|
|
33
|
-
|
|
33
|
+
// `document.body` is null for some documents (e.g. XML or SVG).
|
|
34
|
+
await executionContext.evaluate(() => {
|
|
35
|
+
const el = document.body || document.documentElement;
|
|
36
|
+
if (el) window.getComputedStyle(el);
|
|
37
|
+
}, {
|
|
34
38
|
args: [],
|
|
35
39
|
});
|
|
36
40
|
|
|
@@ -44,6 +44,10 @@ class Stylesheets extends BaseGatherer {
|
|
|
44
44
|
'Stylesheets',
|
|
45
45
|
`Error fetching content of stylesheet with URL "${event.header.sourceURL}"`
|
|
46
46
|
);
|
|
47
|
+
// The stylesheet can be removed between `styleSheetAdded` and fetching its text.
|
|
48
|
+
// This is an expected race, so don't report it.
|
|
49
|
+
if (/No style sheet with given id/.test(err.protocolError)) return null;
|
|
50
|
+
|
|
47
51
|
Sentry.captureException(err, {
|
|
48
52
|
tags: {
|
|
49
53
|
gatherer: 'Stylesheets',
|
|
@@ -74,7 +78,11 @@ class Stylesheets extends BaseGatherer {
|
|
|
74
78
|
|
|
75
79
|
// Force style to recompute.
|
|
76
80
|
// Doesn't appear to be necessary in newer versions of Chrome.
|
|
77
|
-
|
|
81
|
+
// `document.body` is null for some documents (e.g. XML or SVG).
|
|
82
|
+
await executionContext.evaluate(() => {
|
|
83
|
+
const el = document.body || document.documentElement;
|
|
84
|
+
if (el) window.getComputedStyle(el);
|
|
85
|
+
}, {
|
|
78
86
|
args: [],
|
|
79
87
|
});
|
|
80
88
|
|
|
@@ -31,11 +31,9 @@ function convertNodeTimingsToTrace(nodeTimings) {
|
|
|
31
31
|
// Represent all CPU work that was bundled in a task as an EvaluateScript event
|
|
32
32
|
traceEvents.push(...createFakeTaskEvents(node, timing));
|
|
33
33
|
} else {
|
|
34
|
-
/** @type {LH.Artifacts.NetworkRequest} */
|
|
35
|
-
const record = node.rawRequest;
|
|
36
34
|
// Ignore data URIs as they don't really add much value
|
|
37
|
-
if (/^data/.test(
|
|
38
|
-
traceEvents.push(...createFakeNetworkEvents(requestId,
|
|
35
|
+
if (/^data/.test(node.request.url)) continue;
|
|
36
|
+
traceEvents.push(...createFakeNetworkEvents(requestId, node, timing));
|
|
39
37
|
requestId++;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
@@ -123,11 +121,10 @@ function convertNodeTimingsToTrace(nodeTimings) {
|
|
|
123
121
|
|
|
124
122
|
/**
|
|
125
123
|
* @param {number} requestId
|
|
126
|
-
* @param {LH.Artifacts.NetworkRequest} record
|
|
127
124
|
* @param {CompleteNodeTiming} timing
|
|
128
125
|
* @return {LH.TraceEvent}
|
|
129
126
|
*/
|
|
130
|
-
function createWillSendRequestEvent(requestId,
|
|
127
|
+
function createWillSendRequestEvent(requestId, timing) {
|
|
131
128
|
return {
|
|
132
129
|
...baseEvent,
|
|
133
130
|
ph: 'I',
|
|
@@ -142,11 +139,11 @@ function convertNodeTimingsToTrace(nodeTimings) {
|
|
|
142
139
|
|
|
143
140
|
/**
|
|
144
141
|
* @param {number} requestId
|
|
145
|
-
* @param {LH.
|
|
142
|
+
* @param {LH.Gatherer.Simulation.GraphNetworkNode} node
|
|
146
143
|
* @param {CompleteNodeTiming} timing
|
|
147
144
|
* @return {LH.TraceEvent[]}
|
|
148
145
|
*/
|
|
149
|
-
function createFakeNetworkEvents(requestId,
|
|
146
|
+
function createFakeNetworkEvents(requestId, node, timing) {
|
|
150
147
|
if (!('connectionTiming' in timing)) {
|
|
151
148
|
throw new Error('Network node timing incomplete');
|
|
152
149
|
}
|
|
@@ -156,6 +153,12 @@ function convertNodeTimingsToTrace(nodeTimings) {
|
|
|
156
153
|
let {startTime, endTime} = timing;
|
|
157
154
|
if (startTime === endTime) endTime += 0.3;
|
|
158
155
|
|
|
156
|
+
// Use the Lantern request rather than `rawRequest`, which is only an LH.Artifacts.NetworkRequest
|
|
157
|
+
// for graphs built by Lighthouse (not for those built by the trace engine).
|
|
158
|
+
const record = node.request;
|
|
159
|
+
/** @type {Partial<LH.Artifacts.NetworkRequest>|undefined} */
|
|
160
|
+
const rawRequest = node.rawRequest;
|
|
161
|
+
|
|
159
162
|
const requestData = {requestId: requestId.toString(), frame};
|
|
160
163
|
// No `dur` on network instant events but add to keep types happy.
|
|
161
164
|
/** @type {LH.Util.StrictOmit<LH.TraceEvent, 'name'|'ts'|'args'>} */
|
|
@@ -163,12 +166,15 @@ function convertNodeTimingsToTrace(nodeTimings) {
|
|
|
163
166
|
|
|
164
167
|
const sendRequestData = {
|
|
165
168
|
...requestData,
|
|
166
|
-
requestMethod:
|
|
169
|
+
requestMethod: rawRequest?.requestMethod,
|
|
167
170
|
url: record.url,
|
|
168
171
|
priority: record.priority,
|
|
169
172
|
};
|
|
170
173
|
|
|
171
|
-
|
|
174
|
+
// Connectionless requests (disk cache, blob:, filesystem:, etc.) are simulated without
|
|
175
|
+
// any connection timing.
|
|
176
|
+
const {dnsResolutionTime, connectionTime, sslTime, timeToFirstByte} =
|
|
177
|
+
timing.connectionTiming || {};
|
|
172
178
|
let sslStart = -1;
|
|
173
179
|
let sslEnd = -1;
|
|
174
180
|
if (connectionTime !== undefined && sslTime !== undefined) {
|
|
@@ -181,7 +187,7 @@ function convertNodeTimingsToTrace(nodeTimings) {
|
|
|
181
187
|
mimeType: record.mimeType,
|
|
182
188
|
encodedDataLength: record.transferSize,
|
|
183
189
|
fromCache: record.fromDiskCache,
|
|
184
|
-
fromServiceWorker:
|
|
190
|
+
fromServiceWorker: rawRequest?.fetchedViaServiceWorker,
|
|
185
191
|
timing: {
|
|
186
192
|
// `requestTime` is in seconds.
|
|
187
193
|
requestTime: toMicroseconds(startTime) / (1000 * 1000),
|
|
@@ -194,7 +200,7 @@ function convertNodeTimingsToTrace(nodeTimings) {
|
|
|
194
200
|
sslEnd,
|
|
195
201
|
sendStart: connectionTime ?? 0,
|
|
196
202
|
sendEnd: connectionTime ?? 0,
|
|
197
|
-
receiveHeadersEnd: timeToFirstByte,
|
|
203
|
+
receiveHeadersEnd: timeToFirstByte ?? 0,
|
|
198
204
|
workerStart: -1,
|
|
199
205
|
workerReady: -1,
|
|
200
206
|
proxyStart: -1,
|
|
@@ -217,7 +223,7 @@ function convertNodeTimingsToTrace(nodeTimings) {
|
|
|
217
223
|
|
|
218
224
|
// Navigation request needs an additional ResourceWillSendRequest event.
|
|
219
225
|
if (requestId === 1) {
|
|
220
|
-
events.push(createWillSendRequestEvent(requestId,
|
|
226
|
+
events.push(createWillSendRequestEvent(requestId, timing));
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
events.push(
|
|
@@ -449,7 +449,8 @@ function wrapRequestIdleCallback(cpuSlowdownMultiplier) {
|
|
|
449
449
|
*/
|
|
450
450
|
function getNodeDetails(node) {
|
|
451
451
|
// This bookkeeping is for the FullPageScreenshot gatherer.
|
|
452
|
-
|
|
452
|
+
// Pages may have overwritten this global or `Map` itself (see `_cachedNativesPreamble`).
|
|
453
|
+
if (!(window.__lighthouseNodesDontTouchOrAllVarianceGoesAway instanceof Map)) {
|
|
453
454
|
window.__lighthouseNodesDontTouchOrAllVarianceGoesAway = new Map();
|
|
454
455
|
}
|
|
455
456
|
|
package/core/lib/sentry.js
CHANGED
|
@@ -116,11 +116,17 @@ async function init(opts) {
|
|
|
116
116
|
sentryExceptionCache.set(key, true);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/** @type {string[]|undefined} */
|
|
120
|
+
let fingerprint;
|
|
119
121
|
// @ts-expect-error - properties added to protocol method LighthouseErrors.
|
|
120
122
|
if (err.protocolMethod) {
|
|
121
|
-
// Protocol errors all share same stack trace, so add more to fingerprint
|
|
123
|
+
// Protocol errors all share same stack trace, so add more to fingerprint.
|
|
124
|
+
// Numbers (positions, ids, etc.) are normalized so they don't split one error into
|
|
125
|
+
// many issues.
|
|
122
126
|
// @ts-expect-error - properties added to protocol method LighthouseErrors.
|
|
123
|
-
|
|
127
|
+
const protocolError = String(err.protocolError ?? '').replace(/\d+/g, '<n>');
|
|
128
|
+
// @ts-expect-error - properties added to protocol method LighthouseErrors.
|
|
129
|
+
fingerprint = ['{{ default }}', err.protocolMethod, protocolError];
|
|
124
130
|
|
|
125
131
|
opts.tags = opts.tags || {};
|
|
126
132
|
// @ts-expect-error - properties added to protocol method LighthouseErrors.
|
|
@@ -135,6 +141,9 @@ async function init(opts) {
|
|
|
135
141
|
if (opts.tags) {
|
|
136
142
|
scope.setTags(opts.tags);
|
|
137
143
|
}
|
|
144
|
+
if (fingerprint) {
|
|
145
|
+
scope.setFingerprint(fingerprint);
|
|
146
|
+
}
|
|
138
147
|
|
|
139
148
|
// Add extra details
|
|
140
149
|
let extra;
|
|
@@ -84,6 +84,13 @@ export class MainThreadTasks {
|
|
|
84
84
|
* @return {TaskNode[]}
|
|
85
85
|
*/
|
|
86
86
|
static _createTasksFromStartAndEndEvents(taskStartEvents: LH.TraceEvent[], taskEndEvents: LH.TraceEvent[], traceEndTs: number): TaskNode[];
|
|
87
|
+
/**
|
|
88
|
+
* Extends the endTime (and duration) of `task` and its ancestors so that each ends no earlier
|
|
89
|
+
* than `endTime`.
|
|
90
|
+
* @param {TaskNode|undefined} task
|
|
91
|
+
* @param {number} endTime
|
|
92
|
+
*/
|
|
93
|
+
static _extendAncestorEndTimes(task: TaskNode | undefined, endTime: number): void;
|
|
87
94
|
/**
|
|
88
95
|
* This function iterates through the tasks to set the `.parent`/`.children` properties of tasks
|
|
89
96
|
* according to their implied nesting structure. If any of these relationships seem impossible based on
|
|
@@ -213,6 +213,21 @@ class MainThreadTasks {
|
|
|
213
213
|
return tasks;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Extends the endTime (and duration) of `task` and its ancestors so that each ends no earlier
|
|
218
|
+
* than `endTime`.
|
|
219
|
+
* @param {TaskNode|undefined} task
|
|
220
|
+
* @param {number} endTime
|
|
221
|
+
*/
|
|
222
|
+
static _extendAncestorEndTimes(task, endTime) {
|
|
223
|
+
let cur = task;
|
|
224
|
+
while (cur && cur.endTime < endTime) {
|
|
225
|
+
cur.duration += endTime - cur.endTime;
|
|
226
|
+
cur.endTime = endTime;
|
|
227
|
+
cur = cur.parent;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
216
231
|
/**
|
|
217
232
|
* This function iterates through the tasks to set the `.parent`/`.children` properties of tasks
|
|
218
233
|
* according to their implied nesting structure. If any of these relationships seem impossible based on
|
|
@@ -269,12 +284,7 @@ class MainThreadTasks {
|
|
|
269
284
|
currentTask.duration += timeDelta;
|
|
270
285
|
|
|
271
286
|
// Recursively extend parent endTimes, as needed.
|
|
272
|
-
|
|
273
|
-
while (cur && cur.endTime < nextTask.endTime) {
|
|
274
|
-
cur.duration += nextTask.endTime - cur.endTime;
|
|
275
|
-
cur.endTime = nextTask.endTime;
|
|
276
|
-
cur = cur.parent;
|
|
277
|
-
}
|
|
287
|
+
MainThreadTasks._extendAncestorEndTimes(currentTask.parent, nextTask.endTime);
|
|
278
288
|
} else if (nextTask.unbounded) {
|
|
279
289
|
// It's ending at traceEndTs, it means we were missing the end event. We'll truncate it to the parent.
|
|
280
290
|
nextTask.endTime = currentTask.endTime;
|
|
@@ -312,6 +322,8 @@ class MainThreadTasks {
|
|
|
312
322
|
actualParentTask.parent = grandparentTask;
|
|
313
323
|
actualParentTask.startTime = actualChildTask.startTime;
|
|
314
324
|
actualParentTask.duration = actualParentTask.endTime - actualParentTask.startTime;
|
|
325
|
+
// The new parent may now end after its ancestors, so extend them as needed.
|
|
326
|
+
MainThreadTasks._extendAncestorEndTimes(grandparentTask, actualParentTask.endTime);
|
|
315
327
|
currentTask = actualParentTask;
|
|
316
328
|
nextTask = actualChildTask;
|
|
317
329
|
} else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var De=.8999999999999999,Pe=.5,Re=.49999999999999994;function Ie(o){let e=Math.sign(o);o=Math.abs(o);let t=.254829592,n=-.284496736,r=1.421413741,i=-1.453152027,a=1.061405429,s=1/(1+.3275911*o),c=s*(t+s*(n+s*(r+s*(i+s*a))));return e*(1-c*Math.exp(-o*o))}function me({median:o,p10:e},t){if(o<=0)throw new Error("median must be greater than zero");if(e<=0)throw new Error("p10 must be greater than zero");if(e>=o)throw new Error("p10 must be less than the median");if(t<=0)return 1;let n=.9061938024368232,r=Math.max(Number.MIN_VALUE,t/o),i=Math.log(r),a=Math.max(Number.MIN_VALUE,e/o),l=-Math.log(a),s=i*n/l,c=(1-Ie(s))/2,d;return t<=e?d=Math.max(.9,Math.min(1,c)):t<=o?d=Math.max(Pe,Math.min(De,c)):d=Math.max(0,Math.min(Re,c)),d}var O="\u2026",He="\xA0",fe=.9,Ue={PASS:{label:"pass",minScore:fe},AVERAGE:{label:"average",minScore:.5},FAIL:{label:"fail"},ERROR:{label:"error"}},Oe=["com","co","gov","edu","ac","org","go","gob","or","net","in","ne","nic","gouv","web","spb","blog","jus","kiev","mil","wi","qc","ca","bel","on"],E=class o{static get RATINGS(){return Ue}static get PASS_THRESHOLD(){return fe}static get MS_DISPLAY_VALUE(){return`%10d${He}ms`}static isPluginCategory(e){return/^(@[a-z0-9-~][a-z0-9-._~]*\/)?lighthouse-plugin-[a-z0-9-._~]*$/.test(e)}static getFinalDisplayedUrl(e){if(e.finalDisplayedUrl)return e.finalDisplayedUrl;if(e.finalUrl)return e.finalUrl;throw new Error("Could not determine final displayed URL")}static getMainDocumentUrl(e){return e.mainDocumentUrl||e.finalUrl}static getFullPageScreenshot(e){return e.fullPageScreenshot?e.fullPageScreenshot:e.audits["full-page-screenshot"]?.details}static getEntityFromUrl(e,t){return t&&t.find(r=>r.origins.find(i=>e.startsWith(i)))||o.getPseudoRootDomain(e)}static splitMarkdownCodeSpans(e){let t=[],n=e.split(/`(.*?)`/g);for(let r=0;r<n.length;r++){let i=n[r];if(!i)continue;let a=r%2!==0;t.push({isCode:a,text:i})}return t}static splitMarkdownLink(e){let t=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){let[r,i,a]=n.splice(0,3);r&&t.push({isLink:!1,text:r}),i&&a&&t.push({isLink:!0,text:i,linkHref:a})}return t}static truncate(e,t,n="\u2026"){if(e.length<=t)return e;let
|
|
1
|
+
var De=.8999999999999999,Pe=.5,Re=.49999999999999994;function Ie(o){let e=Math.sign(o);o=Math.abs(o);let t=.254829592,n=-.284496736,r=1.421413741,i=-1.453152027,a=1.061405429,s=1/(1+.3275911*o),c=s*(t+s*(n+s*(r+s*(i+s*a))));return e*(1-c*Math.exp(-o*o))}function me({median:o,p10:e},t){if(o<=0)throw new Error("median must be greater than zero");if(e<=0)throw new Error("p10 must be greater than zero");if(e>=o)throw new Error("p10 must be less than the median");if(t<=0)return 1;let n=.9061938024368232,r=Math.max(Number.MIN_VALUE,t/o),i=Math.log(r),a=Math.max(Number.MIN_VALUE,e/o),l=-Math.log(a),s=i*n/l,c=(1-Ie(s))/2,d;return t<=e?d=Math.max(.9,Math.min(1,c)):t<=o?d=Math.max(Pe,Math.min(De,c)):d=Math.max(0,Math.min(Re,c)),d}var O="\u2026",He="\xA0",fe=.9,Ue={PASS:{label:"pass",minScore:fe},AVERAGE:{label:"average",minScore:.5},FAIL:{label:"fail"},ERROR:{label:"error"}},Oe=["com","co","gov","edu","ac","org","go","gob","or","net","in","ne","nic","gouv","web","spb","blog","jus","kiev","mil","wi","qc","ca","bel","on"],E=class o{static get RATINGS(){return Ue}static get PASS_THRESHOLD(){return fe}static get MS_DISPLAY_VALUE(){return`%10d${He}ms`}static isPluginCategory(e){return/^(@[a-z0-9-~][a-z0-9-._~]*\/)?lighthouse-plugin-[a-z0-9-._~]*$/.test(e)}static getFinalDisplayedUrl(e){if(e.finalDisplayedUrl)return e.finalDisplayedUrl;if(e.finalUrl)return e.finalUrl;throw new Error("Could not determine final displayed URL")}static getMainDocumentUrl(e){return e.mainDocumentUrl||e.finalUrl}static getFullPageScreenshot(e){return e.fullPageScreenshot?e.fullPageScreenshot:e.audits["full-page-screenshot"]?.details}static getEntityFromUrl(e,t){return t&&t.find(r=>r.origins.find(i=>e.startsWith(i)))||o.getPseudoRootDomain(e)}static splitMarkdownCodeSpans(e){let t=[],n=e.split(/`(.*?)`/g);for(let r=0;r<n.length;r++){let i=n[r];if(!i)continue;let a=r%2!==0;t.push({isCode:a,text:i})}return t}static splitMarkdownLink(e){let t=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){let[r,i,a]=n.splice(0,3);r&&t.push({isLink:!1,text:r}),i&&a&&t.push({isLink:!0,text:i,linkHref:a})}return t}static truncate(e,t,n="\u2026"){if(e.length<=t)return e;let r;try{r=new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)[Symbol.iterator]()}catch{return e.slice(0,Math.max(0,t-n.length))+n}let i=0;for(let a=0;a<=t-n.length;a++){let l=r.next();if(l.done)return e;i=l.value.index}for(let a=0;a<n.length;a++)if(r.next().done)return e;return e.slice(0,i)+n}static getURLDisplayName(e,t){t=t||{numPathParts:void 0,preserveQuery:void 0,preserveHost:void 0};let n=t.numPathParts!==void 0?t.numPathParts:2,r=t.preserveQuery!==void 0?t.preserveQuery:!0,i=t.preserveHost||!1,a;if(e.protocol==="about:"||e.protocol==="data:")a=e.href;else{a=e.pathname;let s=a.split("/").filter(c=>c.length);n&&s.length>n&&(a=O+s.slice(-1*n).join("/")),i&&(a=`${e.host}/${a.replace(/^\//,"")}`),r&&(a=`${a}${e.search}`)}let l=64;if(e.protocol!=="data:"&&(a=a.slice(0,200),a=a.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,`$1${O}`),a=a.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,`$1${O}`),a=a.replace(/(\d{3})\d{6,}/g,`$1${O}`),a=a.replace(/\u2026+/g,O),a.length>l&&a.includes("?")&&(a=a.replace(/\?([^=]*)(=)?.*/,`?$1$2${O}`),a.length>l&&(a=a.replace(/\?.*/,`?${O}`)))),a.length>l){let s=a.lastIndexOf(".");s>=0?a=a.slice(0,l-1-(a.length-s))+`${O}${a.slice(s)}`:a=a.slice(0,l-1)+O}return a}static getChromeExtensionOrigin(e){let t=new URL(e);return t.protocol+"//"+t.host}static parseURL(e){let t=new URL(e);return{file:o.getURLDisplayName(t),hostname:t.hostname,origin:t.protocol==="chrome-extension:"?o.getChromeExtensionOrigin(e):t.origin}}static createOrReturnURL(e){return e instanceof URL?e:new URL(e)}static getPseudoTld(e){let t=e.split(".").slice(-2);return Oe.includes(t[0])?`.${t.join(".")}`:`.${t[t.length-1]}`}static getPseudoRootDomain(e){let t=o.createOrReturnURL(e).hostname,r=o.getPseudoTld(t).split(".");return t.split(".").slice(-r.length).join(".")}static filterRelevantLines(e,t,n){if(t.length===0)return e.slice(0,n*2+1);let r=3,i=new Set;return t=t.sort((a,l)=>(a.lineNumber||0)-(l.lineNumber||0)),t.forEach(({lineNumber:a})=>{let l=a-n,s=a+n;for(;l<1;)l++,s++;i.has(l-r-1)&&(l-=r);for(let c=l;c<=s;c++){let d=c;i.add(d)}}),e.filter(a=>i.has(a.lineNumber))}static computeLogNormalScore(e,t){let n=me(e,t);return n>.9&&(n+=.05*(n-.9)),Math.floor(n*100)/100}};function $e(o){let e=o.createFragment(),t=o.createElement("style");t.append(`
|
|
2
2
|
.lh-3p-filter {
|
|
3
3
|
color: var(--color-gray-600);
|
|
4
4
|
float: right;
|