lighthouse 11.7.0-dev.20240411 → 11.7.0-dev.20240412
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/core/config/default-config.js +0 -1
- package/package.json +1 -1
- package/report/renderer/report-renderer.js +1 -1
- package/tsconfig.json +0 -1
- package/types/artifacts.d.ts +0 -2
- package/core/gather/driver/service-workers.d.ts +0 -16
- package/core/gather/driver/service-workers.js +0 -52
- package/core/gather/gatherers/service-worker.d.ts +0 -10
- package/core/gather/gatherers/service-worker.js +0 -32
|
@@ -133,7 +133,6 @@ const defaultConfig = {
|
|
|
133
133
|
{id: 'OptimizedImages', gatherer: 'dobetterweb/optimized-images'},
|
|
134
134
|
{id: 'ResponseCompression', gatherer: 'dobetterweb/response-compression'},
|
|
135
135
|
{id: 'RobotsTxt', gatherer: 'seo/robots-txt'},
|
|
136
|
-
{id: 'ServiceWorker', gatherer: 'service-worker'},
|
|
137
136
|
{id: 'Scripts', gatherer: 'scripts'},
|
|
138
137
|
{id: 'SourceMaps', gatherer: 'source-maps'},
|
|
139
138
|
{id: 'Stacks', gatherer: 'stacks'},
|
package/package.json
CHANGED
|
@@ -203,7 +203,7 @@ export class ReportRenderer {
|
|
|
203
203
|
* @return {!DocumentFragment[]}
|
|
204
204
|
*/
|
|
205
205
|
_renderScoreGauges(report, categoryRenderer, specificCategoryRenderers) {
|
|
206
|
-
// Group gauges in this order: default,
|
|
206
|
+
// Group gauges in this order: default, plugins.
|
|
207
207
|
const defaultGauges = [];
|
|
208
208
|
const pluginGauges = [];
|
|
209
209
|
|
package/tsconfig.json
CHANGED
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"core/test/gather/gatherers/offline-test.js",
|
|
57
57
|
"core/test/gather/gatherers/runtime-exceptions-test.js",
|
|
58
58
|
"core/test/gather/gatherers/seo/font-size-test.js",
|
|
59
|
-
"core/test/gather/gatherers/service-worker-test.js",
|
|
60
59
|
"core/test/gather/gatherers/source-maps-test.js",
|
|
61
60
|
"core/test/gather/gatherers/stack-collector-test.js",
|
|
62
61
|
"core/test/gather/gatherers/start-url-test.js",
|
package/types/artifacts.d.ts
CHANGED
|
@@ -141,8 +141,6 @@ export interface GathererArtifacts extends PublicGathererArtifacts {
|
|
|
141
141
|
RobotsTxt: {status: number|null, content: string|null, errorMessage?: string};
|
|
142
142
|
/** The result of calling the shared trace engine root cause analysis. */
|
|
143
143
|
RootCauses: Artifacts.TraceEngineRootCauses;
|
|
144
|
-
/** Version information for all ServiceWorkers active after the first page load. */
|
|
145
|
-
ServiceWorker: {versions: Crdp.ServiceWorker.ServiceWorkerVersion[], registrations: Crdp.ServiceWorker.ServiceWorkerRegistration[]};
|
|
146
144
|
/** Source maps of scripts executed in the page. */
|
|
147
145
|
SourceMaps: Array<Artifacts.SourceMap>;
|
|
148
146
|
/** Information on detected tech stacks (e.g. JS libraries) used by the page. */
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
8
|
-
* @return {Promise<LH.Crdp.ServiceWorker.WorkerVersionUpdatedEvent>}
|
|
9
|
-
*/
|
|
10
|
-
export function getServiceWorkerVersions(session: LH.Gatherer.ProtocolSession): Promise<LH.Crdp.ServiceWorker.WorkerVersionUpdatedEvent>;
|
|
11
|
-
/**
|
|
12
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
13
|
-
* @return {Promise<LH.Crdp.ServiceWorker.WorkerRegistrationUpdatedEvent>}
|
|
14
|
-
*/
|
|
15
|
-
export function getServiceWorkerRegistrations(session: LH.Gatherer.ProtocolSession): Promise<LH.Crdp.ServiceWorker.WorkerRegistrationUpdatedEvent>;
|
|
16
|
-
//# sourceMappingURL=service-workers.d.ts.map
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
9
|
-
* @return {Promise<LH.Crdp.ServiceWorker.WorkerVersionUpdatedEvent>}
|
|
10
|
-
*/
|
|
11
|
-
function getServiceWorkerVersions(session) {
|
|
12
|
-
return new Promise((resolve, reject) => {
|
|
13
|
-
/**
|
|
14
|
-
* @param {LH.Crdp.ServiceWorker.WorkerVersionUpdatedEvent} data
|
|
15
|
-
*/
|
|
16
|
-
const versionUpdatedListener = data => {
|
|
17
|
-
// find a service worker with runningStatus that looks like active
|
|
18
|
-
// on slow connections the serviceworker might still be installing
|
|
19
|
-
const activateCandidates = data.versions.filter(sw => {
|
|
20
|
-
return sw.status !== 'redundant';
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const hasActiveServiceWorker = activateCandidates.find(sw => {
|
|
24
|
-
return sw.status === 'activated';
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (!activateCandidates.length || hasActiveServiceWorker) {
|
|
28
|
-
session.off('ServiceWorker.workerVersionUpdated', versionUpdatedListener);
|
|
29
|
-
session.sendCommand('ServiceWorker.disable').then(_ => resolve(data), reject);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
session.on('ServiceWorker.workerVersionUpdated', versionUpdatedListener);
|
|
34
|
-
|
|
35
|
-
session.sendCommand('ServiceWorker.enable').catch(reject);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
41
|
-
* @return {Promise<LH.Crdp.ServiceWorker.WorkerRegistrationUpdatedEvent>}
|
|
42
|
-
*/
|
|
43
|
-
function getServiceWorkerRegistrations(session) {
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
session.once('ServiceWorker.workerRegistrationUpdated', data => {
|
|
46
|
-
session.sendCommand('ServiceWorker.disable').then(_ => resolve(data), reject);
|
|
47
|
-
});
|
|
48
|
-
session.sendCommand('ServiceWorker.enable').catch(reject);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export {getServiceWorkerVersions, getServiceWorkerRegistrations};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default ServiceWorker;
|
|
2
|
-
declare class ServiceWorker extends BaseGatherer {
|
|
3
|
-
/**
|
|
4
|
-
* @param {LH.Gatherer.Context} context
|
|
5
|
-
* @return {Promise<LH.Artifacts['ServiceWorker']>}
|
|
6
|
-
*/
|
|
7
|
-
getArtifact(context: LH.Gatherer.Context): Promise<LH.Artifacts['ServiceWorker']>;
|
|
8
|
-
}
|
|
9
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
10
|
-
//# sourceMappingURL=service-worker.d.ts.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2016 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
8
|
-
import * as serviceWorkers from '../driver/service-workers.js';
|
|
9
|
-
|
|
10
|
-
class ServiceWorker extends BaseGatherer {
|
|
11
|
-
/** @type {LH.Gatherer.GathererMeta} */
|
|
12
|
-
meta = {
|
|
13
|
-
supportedModes: ['navigation'],
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {LH.Gatherer.Context} context
|
|
18
|
-
* @return {Promise<LH.Artifacts['ServiceWorker']>}
|
|
19
|
-
*/
|
|
20
|
-
async getArtifact(context) {
|
|
21
|
-
const session = context.driver.defaultSession;
|
|
22
|
-
const {versions} = await serviceWorkers.getServiceWorkerVersions(session);
|
|
23
|
-
const {registrations} = await serviceWorkers.getServiceWorkerRegistrations(session);
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
versions,
|
|
27
|
-
registrations,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default ServiceWorker;
|