lighthouse 12.3.0 → 12.4.0
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/core-tests.js +4 -0
- package/core/audits/audit.d.ts +5 -0
- package/core/audits/audit.js +12 -0
- package/core/audits/bootup-time.js +0 -2
- package/core/audits/byte-efficiency/duplicated-javascript.d.ts +4 -5
- package/core/audits/byte-efficiency/duplicated-javascript.js +9 -5
- package/core/audits/byte-efficiency/legacy-javascript.d.ts +2 -2
- package/core/audits/byte-efficiency/legacy-javascript.js +17 -5
- package/core/audits/byte-efficiency/polyfill-graph-data.json +48 -49
- package/core/audits/byte-efficiency/total-byte-weight.js +0 -2
- package/core/audits/clickjacking-mitigation.d.ts +42 -0
- package/core/audits/clickjacking-mitigation.js +139 -0
- package/core/audits/dobetterweb/dom-size.js +0 -2
- package/core/audits/insights/README.md +3 -0
- package/core/audits/insights/cls-culprits-insight.d.ts +25 -0
- package/core/audits/insights/cls-culprits-insight.js +137 -0
- package/core/audits/insights/document-latency-insight.d.ts +11 -0
- package/core/audits/insights/document-latency-insight.js +48 -0
- package/core/audits/insights/dom-size-insight.d.ts +11 -0
- package/core/audits/insights/dom-size-insight.js +85 -0
- package/core/audits/insights/font-display-insight.d.ts +11 -0
- package/core/audits/insights/font-display-insight.js +53 -0
- package/core/audits/insights/forced-reflow-insight.d.ts +11 -0
- package/core/audits/insights/forced-reflow-insight.js +52 -0
- package/core/audits/insights/image-delivery-insight.d.ts +11 -0
- package/core/audits/insights/image-delivery-insight.js +83 -0
- package/core/audits/insights/insight-audit.d.ts +23 -0
- package/core/audits/insights/insight-audit.js +133 -0
- package/core/audits/insights/interaction-to-next-paint-insight.d.ts +11 -0
- package/core/audits/insights/interaction-to-next-paint-insight.js +71 -0
- package/core/audits/insights/lcp-discovery-insight.d.ts +11 -0
- package/core/audits/insights/lcp-discovery-insight.js +48 -0
- package/core/audits/insights/lcp-phases-insight.d.ts +16 -0
- package/core/audits/insights/lcp-phases-insight.js +87 -0
- package/core/audits/insights/long-critical-network-tree-insight.d.ts +11 -0
- package/core/audits/insights/long-critical-network-tree-insight.js +53 -0
- package/core/audits/insights/render-blocking-insight.d.ts +11 -0
- package/core/audits/insights/render-blocking-insight.js +57 -0
- package/core/audits/insights/slow-css-selector-insight.d.ts +11 -0
- package/core/audits/insights/slow-css-selector-insight.js +52 -0
- package/core/audits/insights/third-parties-insight.d.ts +28 -0
- package/core/audits/insights/third-parties-insight.js +90 -0
- package/core/audits/insights/viewport-insight.d.ts +11 -0
- package/core/audits/insights/viewport-insight.js +54 -0
- package/core/audits/layout-shifts.d.ts +0 -1
- package/core/audits/layout-shifts.js +18 -21
- package/core/audits/mainthread-work-breakdown.js +0 -2
- package/core/audits/seo/is-crawlable.d.ts +1 -0
- package/core/audits/server-response-time.js +0 -1
- package/core/computed/metrics/lantern-metric.js +5 -1
- package/core/computed/trace-engine-result.js +71 -17
- package/core/config/default-config.js +37 -1
- package/core/gather/gatherers/inspector-issues.js +3 -0
- package/core/gather/gatherers/trace-elements.d.ts +10 -2
- package/core/gather/gatherers/trace-elements.js +89 -12
- package/core/lib/bf-cache-strings.d.ts +7 -4
- package/core/lib/bf-cache-strings.js +174 -140
- package/core/lib/cdt/generated/ParsedURL.d.ts +1 -0
- package/core/lib/cdt/generated/ParsedURL.js +16 -4
- package/core/lib/cdt/generated/SourceMap.d.ts +32 -5
- package/core/lib/cdt/generated/SourceMap.js +192 -100
- package/core/lib/deprecations-strings.d.ts +78 -98
- package/core/lib/deprecations-strings.js +23 -41
- package/core/lib/i18n/i18n.d.ts +1 -0
- package/core/lib/i18n/i18n.js +2 -0
- package/core/lib/trace-engine.d.ts +1 -0
- package/core/lib/trace-engine.js +2 -0
- package/core/runner.js +2 -0
- package/dist/report/bundle.esm.js +196 -9
- package/dist/report/flow.js +197 -10
- package/dist/report/standalone.js +197 -10
- package/flow-report/src/i18n/i18n.d.ts +2 -0
- package/package.json +15 -13
- package/readme.md +3 -0
- package/report/assets/styles.css +179 -5
- package/report/assets/templates.html +14 -0
- package/report/renderer/components.js +9 -3
- package/report/renderer/details-renderer.d.ts +5 -0
- package/report/renderer/details-renderer.js +24 -0
- package/report/renderer/dom.d.ts +12 -1
- package/report/renderer/dom.js +26 -1
- package/report/renderer/i18n-formatter.d.ts +1 -1
- package/report/renderer/performance-category-renderer.d.ts +10 -0
- package/report/renderer/performance-category-renderer.js +81 -20
- package/report/renderer/report-utils.d.ts +1 -0
- package/report/renderer/report-utils.js +2 -0
- package/report/renderer/topbar-features.js +7 -0
- package/shared/localization/locales/ar-XB.json +74 -26
- package/shared/localization/locales/ar.json +76 -28
- package/shared/localization/locales/bg.json +74 -26
- package/shared/localization/locales/ca.json +74 -26
- package/shared/localization/locales/cs.json +74 -26
- package/shared/localization/locales/da.json +74 -26
- package/shared/localization/locales/de.json +75 -27
- package/shared/localization/locales/el.json +74 -26
- package/shared/localization/locales/en-GB.json +74 -26
- package/shared/localization/locales/en-US.json +288 -30
- package/shared/localization/locales/en-XA.json +48 -24
- package/shared/localization/locales/en-XL.json +288 -30
- package/shared/localization/locales/es-419.json +74 -26
- package/shared/localization/locales/es.json +74 -26
- package/shared/localization/locales/fi.json +74 -26
- package/shared/localization/locales/fil.json +75 -27
- package/shared/localization/locales/fr.json +74 -26
- package/shared/localization/locales/he.json +82 -34
- package/shared/localization/locales/hi.json +74 -26
- package/shared/localization/locales/hr.json +75 -27
- package/shared/localization/locales/hu.json +74 -26
- package/shared/localization/locales/id.json +74 -26
- package/shared/localization/locales/it.json +85 -37
- package/shared/localization/locales/ja.json +75 -27
- package/shared/localization/locales/ko.json +75 -27
- package/shared/localization/locales/lt.json +75 -27
- package/shared/localization/locales/lv.json +74 -26
- package/shared/localization/locales/nl.json +74 -26
- package/shared/localization/locales/no.json +75 -27
- package/shared/localization/locales/pl.json +74 -26
- package/shared/localization/locales/pt-PT.json +74 -26
- package/shared/localization/locales/pt.json +74 -26
- package/shared/localization/locales/ro.json +74 -26
- package/shared/localization/locales/ru.json +74 -26
- package/shared/localization/locales/sk.json +74 -26
- package/shared/localization/locales/sl.json +74 -26
- package/shared/localization/locales/sr-Latn.json +74 -26
- package/shared/localization/locales/sr.json +74 -26
- package/shared/localization/locales/sv.json +74 -26
- package/shared/localization/locales/ta.json +74 -26
- package/shared/localization/locales/te.json +74 -26
- package/shared/localization/locales/th.json +76 -28
- package/shared/localization/locales/tr.json +74 -26
- package/shared/localization/locales/uk.json +74 -26
- package/shared/localization/locales/vi.json +74 -26
- package/shared/localization/locales/zh-HK.json +75 -27
- package/shared/localization/locales/zh-TW.json +74 -26
- package/shared/localization/locales/zh.json +74 -26
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +3 -0
- package/types/artifacts.d.ts +5 -3
- package/types/audit.d.ts +2 -0
- package/types/lhr/audit-details.d.ts +13 -1
- package/types/lhr/audit-result.d.ts +2 -0
- package/core/gather/gatherers/root-causes.d.ts +0 -19
- package/core/gather/gatherers/root-causes.js +0 -144
|
@@ -21,6 +21,7 @@ type Details =
|
|
|
21
21
|
Details.List |
|
|
22
22
|
Details.Opportunity |
|
|
23
23
|
Details.Screenshot |
|
|
24
|
+
Details.Checklist |
|
|
24
25
|
Details.Table;
|
|
25
26
|
|
|
26
27
|
// Details namespace.
|
|
@@ -108,6 +109,11 @@ declare module Details {
|
|
|
108
109
|
left: number;
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
interface Checklist extends BaseDetails {
|
|
113
|
+
type: 'checklist',
|
|
114
|
+
items: Record<string, {value: boolean, label: IcuMessage | string}>,
|
|
115
|
+
}
|
|
116
|
+
|
|
111
117
|
interface Table extends BaseDetails {
|
|
112
118
|
type: 'table';
|
|
113
119
|
headings: TableColumnHeading[];
|
|
@@ -151,7 +157,7 @@ declare module Details {
|
|
|
151
157
|
type ItemValueType = 'bytes' | 'code' | 'link' | 'ms' | 'multi' | 'node' | 'source-location' | 'numeric' | 'text' | 'thumbnail' | 'timespanMs' | 'url';
|
|
152
158
|
|
|
153
159
|
/** Possible types of values found within table items. */
|
|
154
|
-
type ItemValue = string | number | boolean | DebugData | NodeValue | SourceLocationValue | LinkValue | UrlValue | CodeValue | NumericValue | IcuMessage | TableSubItems;
|
|
160
|
+
type ItemValue = string | number | boolean | DebugData | NodeValue | SourceLocationValue | LinkValue | UrlValue | CodeValue | NumericValue | TextValue | IcuMessage | TableSubItems;
|
|
155
161
|
|
|
156
162
|
interface TableColumnHeading {
|
|
157
163
|
/**
|
|
@@ -230,6 +236,8 @@ declare module Details {
|
|
|
230
236
|
snippet?: string;
|
|
231
237
|
/** A human-friendly text descriptor that's used to identify the node more quickly. */
|
|
232
238
|
nodeLabel?: string;
|
|
239
|
+
/** A human-friendly explainer on how to approach the possible fix. */
|
|
240
|
+
explanation?: string;
|
|
233
241
|
}
|
|
234
242
|
|
|
235
243
|
/**
|
|
@@ -309,6 +317,10 @@ declare module Details {
|
|
|
309
317
|
granularity?: number,
|
|
310
318
|
}
|
|
311
319
|
|
|
320
|
+
interface TextValue {
|
|
321
|
+
type: 'text',
|
|
322
|
+
value: IcuMessage | string,
|
|
323
|
+
}
|
|
312
324
|
}
|
|
313
325
|
|
|
314
326
|
export default Details;
|
|
@@ -76,4 +76,6 @@ export interface Result {
|
|
|
76
76
|
};
|
|
77
77
|
/** A number indicating how much guidance Lighthouse provides to solve the problem in this audit on a 1-3 scale. Higher means more guidance. */
|
|
78
78
|
guidanceLevel?: number;
|
|
79
|
+
/** A list of audit ids that this audit replaces. Used to ensure the report does not render the audits in this list at the same time as the audit which contains the list. */
|
|
80
|
+
replacesAudits?: string[];
|
|
79
81
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default RootCauses;
|
|
2
|
-
declare class RootCauses extends BaseGatherer {
|
|
3
|
-
static symbol: symbol;
|
|
4
|
-
/**
|
|
5
|
-
* @param {LH.Gatherer.Driver} driver
|
|
6
|
-
* @param {LH.Artifacts.TraceEngineResult['data']} traceParsedData
|
|
7
|
-
* @return {Promise<LH.Artifacts.TraceEngineRootCauses>}
|
|
8
|
-
*/
|
|
9
|
-
static runRootCauseAnalysis(driver: LH.Gatherer.Driver, traceParsedData: LH.Artifacts.TraceEngineResult["data"]): Promise<LH.Artifacts.TraceEngineRootCauses>;
|
|
10
|
-
/** @type {LH.Gatherer.GathererMeta<'Trace'>} */
|
|
11
|
-
meta: LH.Gatherer.GathererMeta<"Trace">;
|
|
12
|
-
/**
|
|
13
|
-
* @param {LH.Gatherer.Context<'Trace'>} context
|
|
14
|
-
* @return {Promise<LH.Artifacts.TraceEngineRootCauses>}
|
|
15
|
-
*/
|
|
16
|
-
getArtifact(context: LH.Gatherer.Context<"Trace">): Promise<LH.Artifacts.TraceEngineRootCauses>;
|
|
17
|
-
}
|
|
18
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
19
|
-
//# sourceMappingURL=root-causes.d.ts.map
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
8
|
-
import Trace from './trace.js';
|
|
9
|
-
import * as TraceEngine from '../../lib/trace-engine.js';
|
|
10
|
-
import {TraceEngineResult} from '../../computed/trace-engine-result.js';
|
|
11
|
-
|
|
12
|
-
class RootCauses extends BaseGatherer {
|
|
13
|
-
static symbol = Symbol('RootCauses');
|
|
14
|
-
|
|
15
|
-
/** @type {LH.Gatherer.GathererMeta<'Trace'>} */
|
|
16
|
-
meta = {
|
|
17
|
-
symbol: RootCauses.symbol,
|
|
18
|
-
supportedModes: ['timespan', 'navigation'],
|
|
19
|
-
dependencies: {Trace: Trace.symbol},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @param {LH.Gatherer.Driver} driver
|
|
24
|
-
* @param {LH.Artifacts.TraceEngineResult['data']} traceParsedData
|
|
25
|
-
* @return {Promise<LH.Artifacts.TraceEngineRootCauses>}
|
|
26
|
-
*/
|
|
27
|
-
static async runRootCauseAnalysis(driver, traceParsedData) {
|
|
28
|
-
await driver.defaultSession.sendCommand('DOM.enable');
|
|
29
|
-
await driver.defaultSession.sendCommand('CSS.enable');
|
|
30
|
-
|
|
31
|
-
// DOM.getDocument is necessary for pushNodesByBackendIdsToFrontend to properly retrieve
|
|
32
|
-
// nodeIds if the DOM domain was enabled before this gatherer, invoke it to be safe.
|
|
33
|
-
await driver.defaultSession.sendCommand('DOM.getDocument', {depth: -1, pierce: true});
|
|
34
|
-
|
|
35
|
-
/** @type {import('@paulirish/trace_engine').RootCauses.RootCauses.RootCauseProtocolInterface} */
|
|
36
|
-
const protocolInterface = {
|
|
37
|
-
/** @param {string} url */
|
|
38
|
-
// eslint-disable-next-line no-unused-vars
|
|
39
|
-
getInitiatorForRequest(url) {
|
|
40
|
-
return null;
|
|
41
|
-
},
|
|
42
|
-
/** @param {import('@paulirish/trace_engine/generated/protocol.js').DOM.BackendNodeId[]} backendNodeIds */
|
|
43
|
-
async pushNodesByBackendIdsToFrontend(backendNodeIds) {
|
|
44
|
-
const response = await driver.defaultSession.sendCommand(
|
|
45
|
-
'DOM.pushNodesByBackendIdsToFrontend', {backendNodeIds});
|
|
46
|
-
const nodeIds =
|
|
47
|
-
/** @type {import('@paulirish/trace_engine/generated/protocol.js').DOM.NodeId[]} */(
|
|
48
|
-
response.nodeIds);
|
|
49
|
-
return nodeIds;
|
|
50
|
-
},
|
|
51
|
-
/** @param {import('@paulirish/trace_engine/generated/protocol.js').DOM.NodeId} nodeId */
|
|
52
|
-
async getNode(nodeId) {
|
|
53
|
-
try {
|
|
54
|
-
const response = await driver.defaultSession.sendCommand('DOM.describeNode', {nodeId});
|
|
55
|
-
// This always zero, so let's fix it here.
|
|
56
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=1515175
|
|
57
|
-
response.node.nodeId = nodeId;
|
|
58
|
-
const node =
|
|
59
|
-
/** @type {import('@paulirish/trace_engine/generated/protocol.js').DOM.Node} */(
|
|
60
|
-
response.node);
|
|
61
|
-
return node;
|
|
62
|
-
} catch (err) {
|
|
63
|
-
if (err.message.includes('Could not find node with given id')) {
|
|
64
|
-
// TODO: when injecting an iframe, the engine gets the node of that frame's document element.
|
|
65
|
-
// But we don't have a way to access that frame. We just have our default session.
|
|
66
|
-
// Ex:
|
|
67
|
-
// node cli http://localhost:10503/shift-attribution.html --quiet --only-audits layout-shifts
|
|
68
|
-
// To fix we must:
|
|
69
|
-
// - Change trace engine `getNode` protocol interface to also give frame id
|
|
70
|
-
// - Expand our driver.targetManager to know how to talk to a session connected to a specific frame
|
|
71
|
-
// When this is fixed, remove this try/catch.
|
|
72
|
-
// Note: this could be buggy by giving the wrong node detail if a node id meant for a non-main frame
|
|
73
|
-
// happens to match one from the main frame ... which is pretty likely...
|
|
74
|
-
// TODO: fix trace engine type to allow returning null.
|
|
75
|
-
return /** @type {any} */(null);
|
|
76
|
-
}
|
|
77
|
-
throw err;
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
/** @param {number} nodeId */
|
|
81
|
-
async getComputedStyleForNode(nodeId) {
|
|
82
|
-
try {
|
|
83
|
-
const response = await driver.defaultSession.sendCommand(
|
|
84
|
-
'CSS.getComputedStyleForNode', {nodeId});
|
|
85
|
-
return response.computedStyle;
|
|
86
|
-
} catch {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
/** @param {import('@paulirish/trace_engine/generated/protocol.js').DOM.NodeId} nodeId */
|
|
91
|
-
async getMatchedStylesForNode(nodeId) {
|
|
92
|
-
try {
|
|
93
|
-
const response = await driver.defaultSession.sendCommand(
|
|
94
|
-
'CSS.getMatchedStylesForNode', {nodeId});
|
|
95
|
-
return {...response, getError() {}};
|
|
96
|
-
} catch (err) {
|
|
97
|
-
return /** @type {any} */({getError() {
|
|
98
|
-
return err.toString();
|
|
99
|
-
}});
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
/** @param {string} url */
|
|
103
|
-
// @ts-expect-error not using, dont care about type error.
|
|
104
|
-
// eslint-disable-next-line no-unused-vars
|
|
105
|
-
async fontFaceForSource(url) {
|
|
106
|
-
return null;
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/** @type {LH.Artifacts.TraceEngineRootCauses} */
|
|
111
|
-
const rootCauses = {
|
|
112
|
-
layoutShifts: {},
|
|
113
|
-
};
|
|
114
|
-
const rootCausesEngine = new TraceEngine.RootCauses(protocolInterface);
|
|
115
|
-
const layoutShiftEvents = traceParsedData.LayoutShifts.clusters.flatMap(c => c.events);
|
|
116
|
-
for (const event of layoutShiftEvents) {
|
|
117
|
-
const r = await rootCausesEngine.layoutShifts.rootCausesForEvent(traceParsedData, event);
|
|
118
|
-
if (!r) continue;
|
|
119
|
-
|
|
120
|
-
for (const cause of r.fontChanges) {
|
|
121
|
-
// TODO: why isn't trace engine unwrapping this promise ...
|
|
122
|
-
cause.fontFace = await cause.fontFace;
|
|
123
|
-
}
|
|
124
|
-
rootCauses.layoutShifts[layoutShiftEvents.indexOf(event)] = r;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
await driver.defaultSession.sendCommand('DOM.disable');
|
|
128
|
-
await driver.defaultSession.sendCommand('CSS.disable');
|
|
129
|
-
|
|
130
|
-
return rootCauses;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @param {LH.Gatherer.Context<'Trace'>} context
|
|
135
|
-
* @return {Promise<LH.Artifacts.TraceEngineRootCauses>}
|
|
136
|
-
*/
|
|
137
|
-
async getArtifact(context) {
|
|
138
|
-
const trace = context.dependencies.Trace;
|
|
139
|
-
const traceEngineResult = await TraceEngineResult.request({trace}, context);
|
|
140
|
-
return RootCauses.runRootCauseAnalysis(context.driver, traceEngineResult.data);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export default RootCauses;
|