lighthouse 12.2.1-dev.20241014 → 12.2.1-dev.20241015
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.
|
@@ -71,7 +71,7 @@ export class NetworkMonitor extends NetworkMonitor_base {
|
|
|
71
71
|
* @param {(request: NetworkRequest) => boolean} [requestFilter]
|
|
72
72
|
* @return {boolean}
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
_isIdlePeriod(allowedRequests: number, requestFilter?: ((request: NetworkRequest) => boolean) | undefined): boolean;
|
|
75
75
|
/**
|
|
76
76
|
* Emits the appropriate network status event.
|
|
77
77
|
*/
|
|
@@ -129,7 +129,7 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
|
|
|
129
129
|
* Returns whether the network is completely idle (i.e. there are 0 inflight network requests).
|
|
130
130
|
*/
|
|
131
131
|
isIdle() {
|
|
132
|
-
return this.
|
|
132
|
+
return this._isIdlePeriod(0);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/**
|
|
@@ -144,10 +144,13 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
|
|
|
144
144
|
const rootFrameRequest = requests.find(r => r.resourceType === 'Document');
|
|
145
145
|
const rootFrameId = rootFrameRequest?.frameId;
|
|
146
146
|
|
|
147
|
-
return this.
|
|
147
|
+
return this._isIdlePeriod(
|
|
148
148
|
0,
|
|
149
|
+
// Return true if it should be a candidate for critical.
|
|
149
150
|
request =>
|
|
150
151
|
request.frameId === rootFrameId &&
|
|
152
|
+
// WebSocket and Server-sent Events are typically long-lived and shouldn't be considered critical.
|
|
153
|
+
request.resourceType !== 'WebSocket' && request.resourceType !== 'EventSource' &&
|
|
151
154
|
(request.priority === 'VeryHigh' || request.priority === 'High')
|
|
152
155
|
);
|
|
153
156
|
}
|
|
@@ -156,7 +159,7 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
|
|
|
156
159
|
* Returns whether the network is semi-idle (i.e. there are 2 or fewer inflight network requests).
|
|
157
160
|
*/
|
|
158
161
|
is2Idle() {
|
|
159
|
-
return this.
|
|
162
|
+
return this._isIdlePeriod(2);
|
|
160
163
|
}
|
|
161
164
|
|
|
162
165
|
/**
|
|
@@ -166,7 +169,7 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
|
|
|
166
169
|
* @param {(request: NetworkRequest) => boolean} [requestFilter]
|
|
167
170
|
* @return {boolean}
|
|
168
171
|
*/
|
|
169
|
-
|
|
172
|
+
_isIdlePeriod(allowedRequests, requestFilter) {
|
|
170
173
|
if (!this._networkRecorder) return false;
|
|
171
174
|
const requests = this._networkRecorder.getRawRecords();
|
|
172
175
|
let inflightRequests = 0;
|
|
@@ -174,7 +177,7 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
|
|
|
174
177
|
for (let i = 0; i < requests.length; i++) {
|
|
175
178
|
const request = requests[i];
|
|
176
179
|
if (request.finished) continue;
|
|
177
|
-
if (requestFilter
|
|
180
|
+
if (requestFilter?.(request) === false) continue;
|
|
178
181
|
if (NetworkRequest.isNonNetworkRequest(request)) continue;
|
|
179
182
|
inflightRequests++;
|
|
180
183
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "12.2.1-dev.
|
|
4
|
+
"version": "12.2.1-dev.20241015",
|
|
5
5
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
6
6
|
"main": "./core/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
},
|
|
183
183
|
"dependencies": {
|
|
184
184
|
"@paulirish/trace_engine": "0.0.32",
|
|
185
|
-
"@sentry/node": "^
|
|
185
|
+
"@sentry/node": "^7.0.0",
|
|
186
186
|
"axe-core": "^4.10.0",
|
|
187
187
|
"chrome-launcher": "^1.1.2",
|
|
188
188
|
"configstore": "^5.0.1",
|