lighthouse 12.8.2-dev.20250928 → 12.8.2-dev.20250930

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.
Files changed (71) hide show
  1. package/core/audits/audit.d.ts +0 -4
  2. package/core/audits/audit.js +2 -12
  3. package/core/audits/insights/image-delivery-insight.js +4 -1
  4. package/core/audits/seo/manual/structured-data.js +1 -1
  5. package/core/config/default-config.js +0 -6
  6. package/core/gather/navigation-runner.js +0 -3
  7. package/core/lib/asset-saver.d.ts +2 -2
  8. package/core/lib/asset-saver.js +33 -43
  9. package/core/lib/deprecations-strings.js +1 -1
  10. package/core/runner.js +1 -8
  11. package/dist/report/bundle.esm.js +1 -1
  12. package/dist/report/flow.js +1 -1
  13. package/dist/report/standalone.js +1 -1
  14. package/package.json +1 -1
  15. package/report/renderer/report-ui-features.js +0 -1
  16. package/shared/localization/locales/ar-XB.json +0 -27
  17. package/shared/localization/locales/ar.json +0 -27
  18. package/shared/localization/locales/bg.json +0 -27
  19. package/shared/localization/locales/ca.json +0 -27
  20. package/shared/localization/locales/cs.json +0 -27
  21. package/shared/localization/locales/da.json +0 -27
  22. package/shared/localization/locales/de.json +0 -27
  23. package/shared/localization/locales/el.json +0 -27
  24. package/shared/localization/locales/en-GB.json +0 -27
  25. package/shared/localization/locales/en-US.json +1 -28
  26. package/shared/localization/locales/en-XA.json +0 -27
  27. package/shared/localization/locales/en-XL.json +1 -28
  28. package/shared/localization/locales/es-419.json +0 -27
  29. package/shared/localization/locales/es.json +0 -27
  30. package/shared/localization/locales/fi.json +0 -27
  31. package/shared/localization/locales/fil.json +0 -27
  32. package/shared/localization/locales/fr.json +0 -27
  33. package/shared/localization/locales/he.json +0 -27
  34. package/shared/localization/locales/hi.json +0 -27
  35. package/shared/localization/locales/hr.json +0 -27
  36. package/shared/localization/locales/hu.json +0 -27
  37. package/shared/localization/locales/id.json +0 -27
  38. package/shared/localization/locales/it.json +0 -27
  39. package/shared/localization/locales/ja.json +0 -27
  40. package/shared/localization/locales/ko.json +0 -27
  41. package/shared/localization/locales/lt.json +0 -27
  42. package/shared/localization/locales/lv.json +0 -27
  43. package/shared/localization/locales/nl.json +0 -27
  44. package/shared/localization/locales/no.json +0 -27
  45. package/shared/localization/locales/pl.json +0 -27
  46. package/shared/localization/locales/pt-PT.json +0 -27
  47. package/shared/localization/locales/pt.json +0 -27
  48. package/shared/localization/locales/ro.json +0 -27
  49. package/shared/localization/locales/ru.json +0 -27
  50. package/shared/localization/locales/sk.json +0 -27
  51. package/shared/localization/locales/sl.json +0 -27
  52. package/shared/localization/locales/sr-Latn.json +0 -27
  53. package/shared/localization/locales/sr.json +0 -27
  54. package/shared/localization/locales/sv.json +0 -27
  55. package/shared/localization/locales/ta.json +0 -27
  56. package/shared/localization/locales/te.json +0 -27
  57. package/shared/localization/locales/th.json +0 -27
  58. package/shared/localization/locales/tr.json +0 -27
  59. package/shared/localization/locales/uk.json +0 -27
  60. package/shared/localization/locales/vi.json +0 -27
  61. package/shared/localization/locales/zh-HK.json +0 -27
  62. package/shared/localization/locales/zh-TW.json +0 -27
  63. package/shared/localization/locales/zh.json +0 -27
  64. package/tsconfig-base.json +1 -1
  65. package/types/artifacts.d.ts +0 -4
  66. package/core/audits/third-party-facades.d.ts +0 -41
  67. package/core/audits/third-party-facades.js +0 -234
  68. package/core/gather/gatherers/devtools-log-compat.d.ts +0 -13
  69. package/core/gather/gatherers/devtools-log-compat.js +0 -35
  70. package/core/gather/gatherers/trace-compat.d.ts +0 -13
  71. package/core/gather/gatherers/trace-compat.js +0 -35
@@ -1,234 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- /**
8
- * @fileoverview Audit which identifies third-party code on the page which can be lazy loaded.
9
- * The audit will recommend a facade alternative which is used to imitate the third-party resource until it is needed.
10
- *
11
- * Entity: Set of domains which are used by a company or product area to deliver third-party resources
12
- * Product: Specific piece of software belonging to an entity. Entities can have multiple products.
13
- * Facade: Placeholder for a product which looks likes the actual product and replaces itself with that product when the user needs it.
14
- */
15
-
16
- /** @typedef {import("third-party-web").IEntity} ThirdPartyEntity */
17
- /** @typedef {import("third-party-web").IProduct} ThirdPartyProduct*/
18
- /** @typedef {import("third-party-web").IFacade} ThirdPartyFacade*/
19
-
20
- /** @typedef {{product: ThirdPartyProduct, entity: ThirdPartyEntity}} FacadableProduct */
21
-
22
- import {Audit} from './audit.js';
23
- import * as i18n from '../lib/i18n/i18n.js';
24
- import {EntityClassification} from '../computed/entity-classification.js';
25
- import thirdPartyWeb from '../lib/third-party-web.js';
26
- import {NetworkRecords} from '../computed/network-records.js';
27
- import ThirdPartySummary from './third-party-summary.js';
28
- import {TBTImpactTasks} from '../computed/tbt-impact-tasks.js';
29
-
30
- const UIStrings = {
31
- /** Title of a diagnostic audit that provides details about the third-party code on a web page that can be lazy loaded with a facade alternative. This descriptive title is shown to users when no resources have facade alternatives available. A facade is a lightweight component which looks like the desired resource. Lazy loading means resources are deferred until they are needed. Third-party code refers to resources that are not within the control of the site owner. */
32
- title: 'Lazy load third-party resources with facades',
33
- /** Title of a diagnostic audit that provides details about the third-party code on a web page that can be lazy loaded with a facade alternative. This descriptive title is shown to users when one or more third-party resources have available facade alternatives. A facade is a lightweight component which looks like the desired resource. Lazy loading means resources are deferred until they are needed. Third-party code refers to resources that are not within the control of the site owner. */
34
- failureTitle: 'Some third-party resources can be lazy loaded with a facade',
35
- /** Description of a Lighthouse audit that identifies the third-party code on the page that can be lazy loaded with a facade alternative. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. A facade is a lightweight component which looks like the desired resource. Lazy loading means resources are deferred until they are needed. Third-party code refers to resources that are not within the control of the site owner. */
36
- description: 'Some third-party embeds can be lazy loaded. ' +
37
- 'Consider replacing them with a facade until they are required. ' +
38
- '[Learn how to defer third-parties with a facade](https://developer.chrome.com/docs/lighthouse/performance/third-party-facades/).',
39
- /** Summary text for the result of a Lighthouse audit that identifies the third-party code on a web page that can be lazy loaded with a facade alternative. This text summarizes the number of lazy loading facades that can be used on the page. A facade is a lightweight component which looks like the desired resource. */
40
- displayValue: `{itemCount, plural,
41
- =1 {# facade alternative available}
42
- other {# facade alternatives available}
43
- }`,
44
- /** Label for a table column that displays the name of the product that a URL is used for. The products in the column will be pieces of software used on the page, like the "YouTube Embedded Player" or the "Drift Live Chat" box. */
45
- columnProduct: 'Product',
46
- /**
47
- * @description Template for a table entry that gives the name of a product which we categorize as video related.
48
- * @example {YouTube Embedded Player} productName
49
- */
50
- categoryVideo: '{productName} (Video)',
51
- /**
52
- * @description Template for a table entry that gives the name of a product which we categorize as customer success related. Customer success means the product supports customers by offering chat and contact solutions.
53
- * @example {Intercom Widget} productName
54
- */
55
- categoryCustomerSuccess: '{productName} (Customer Success)',
56
- /**
57
- * @description Template for a table entry that gives the name of a product which we categorize as marketing related.
58
- * @example {Drift Live Chat} productName
59
- */
60
- categoryMarketing: '{productName} (Marketing)',
61
- /**
62
- * @description Template for a table entry that gives the name of a product which we categorize as social related.
63
- * @example {Facebook Messenger Customer Chat} productName
64
- */
65
- categorySocial: '{productName} (Social)',
66
- };
67
-
68
- const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
69
-
70
- /** @type {Record<string, string>} */
71
- const CATEGORY_UI_MAP = {
72
- 'video': UIStrings.categoryVideo,
73
- 'customer-success': UIStrings.categoryCustomerSuccess,
74
- 'marketing': UIStrings.categoryMarketing,
75
- 'social': UIStrings.categorySocial,
76
- };
77
-
78
- class ThirdPartyFacades extends Audit {
79
- /**
80
- * @return {LH.Audit.Meta}
81
- */
82
- static get meta() {
83
- return {
84
- id: 'third-party-facades',
85
- title: str_(UIStrings.title),
86
- failureTitle: str_(UIStrings.failureTitle),
87
- description: str_(UIStrings.description),
88
- supportedModes: ['navigation'],
89
- guidanceLevel: 3,
90
- requiredArtifacts: ['Trace', 'DevtoolsLog', 'URL', 'GatherContext', 'SourceMaps'],
91
- scoreDisplayMode: Audit.SCORING_MODES.METRIC_SAVINGS,
92
- };
93
- }
94
-
95
- /**
96
- * Sort items by transfer size and combine small items into a single row.
97
- * Items will be mutated in place to a maximum of 6 rows.
98
- * @param {import('./third-party-summary.js').URLSummary[]} items
99
- */
100
- static condenseItems(items) {
101
- items.sort((a, b) => b.transferSize - a.transferSize);
102
-
103
- // Items <1KB are condensed. If all items are <1KB, condense all but the largest.
104
- let splitIndex = items.findIndex((item) => item.transferSize < 1000) || 1;
105
- // Show details for top 5 items.
106
- if (splitIndex === -1 || splitIndex > 5) splitIndex = 5;
107
- // If there is only 1 item to condense, leave it as is.
108
- if (splitIndex >= items.length - 1) return;
109
-
110
- const remainder = items.splice(splitIndex);
111
- const finalItem = remainder.reduce((result, item) => {
112
- result.transferSize += item.transferSize;
113
- result.blockingTime += item.blockingTime;
114
- return result;
115
- });
116
-
117
- // If condensed row is still <1KB, don't show it.
118
- if (finalItem.transferSize < 1000) return;
119
-
120
- finalItem.url = str_(i18n.UIStrings.otherResourcesLabel);
121
- items.push(finalItem);
122
- }
123
-
124
- /**
125
- * @param {Map<string, import('./third-party-summary.js').Summary>} byURL
126
- * @param {LH.Artifacts.EntityClassification} classifiedEntities
127
- * @return {FacadableProduct[]}
128
- */
129
- static getProductsWithFacade(byURL, classifiedEntities) {
130
- /** @type {Map<string, FacadableProduct>} */
131
- const facadableProductMap = new Map();
132
- for (const url of byURL.keys()) {
133
- const entity = classifiedEntities.entityByUrl.get(url);
134
- if (!entity || classifiedEntities.isFirstParty(url)) continue;
135
-
136
- const product = thirdPartyWeb.getProduct(url);
137
- if (!product || !product.facades || !product.facades.length) continue;
138
-
139
- if (facadableProductMap.has(product.name)) continue;
140
- facadableProductMap.set(product.name, {product, entity});
141
- }
142
-
143
- return Array.from(facadableProductMap.values());
144
- }
145
-
146
- /**
147
- * @param {LH.Artifacts} artifacts
148
- * @param {LH.Audit.Context} context
149
- * @return {Promise<LH.Audit.Product>}
150
- */
151
- static async audit(artifacts, context) {
152
- const settings = context.settings;
153
- const devtoolsLog = artifacts.DevtoolsLog;
154
- const networkRecords = await NetworkRecords.request(devtoolsLog, context);
155
- const classifiedEntities = await EntityClassification.request(
156
- {URL: artifacts.URL, devtoolsLog}, context);
157
-
158
- const metricComputationData = Audit.makeMetricComputationDataInput(artifacts, context);
159
- const tbtImpactTasks = await TBTImpactTasks.request(metricComputationData, context);
160
-
161
- const multiplier = settings.throttlingMethod === 'simulate' ?
162
- settings.throttling.cpuSlowdownMultiplier : 1;
163
- const summaries = ThirdPartySummary.getSummaries(networkRecords, tbtImpactTasks, multiplier,
164
- classifiedEntities);
165
- const facadableProducts =
166
- ThirdPartyFacades.getProductsWithFacade(summaries.byURL, classifiedEntities);
167
-
168
- let tbtImpact = 0;
169
-
170
- /** @type {LH.Audit.Details.TableItem[]} */
171
- const results = [];
172
- for (const {product, entity} of facadableProducts) {
173
- const categoryTemplate = CATEGORY_UI_MAP[product.categories[0]];
174
-
175
- let productWithCategory;
176
- if (categoryTemplate) {
177
- // Display product name with category next to it in the same column.
178
- productWithCategory = str_(categoryTemplate, {productName: product.name});
179
- } else {
180
- // Just display product name if no category is found.
181
- productWithCategory = product.name;
182
- }
183
-
184
- const urls = summaries.urls.get(entity);
185
- const entitySummary = summaries.byEntity.get(entity);
186
- if (!urls || !entitySummary) continue;
187
-
188
- tbtImpact += entitySummary.tbtImpact;
189
-
190
- const items = Array.from(urls).map((url) => {
191
- const urlStats = summaries.byURL.get(url);
192
- return /** @type {import('./third-party-summary.js').URLSummary} */ ({url, ...urlStats});
193
- });
194
- this.condenseItems(items);
195
- results.push({
196
- product: productWithCategory,
197
- transferSize: entitySummary.transferSize,
198
- blockingTime: entitySummary.blockingTime,
199
- subItems: {type: 'subitems', items},
200
- // Add entity manually since facades don't have a single `url`.
201
- entity: entity.name,
202
- });
203
- }
204
-
205
- if (!results.length) {
206
- return {
207
- score: 1,
208
- notApplicable: true,
209
- metricSavings: {TBT: 0},
210
- };
211
- }
212
-
213
- /** @type {LH.Audit.Details.Table['headings']} */
214
- const headings = [
215
- /* eslint-disable max-len */
216
- {key: 'product', valueType: 'text', subItemsHeading: {key: 'url', valueType: 'url'}, label: str_(UIStrings.columnProduct)},
217
- {key: 'transferSize', valueType: 'bytes', subItemsHeading: {key: 'transferSize'}, granularity: 1, label: str_(i18n.UIStrings.columnTransferSize)},
218
- {key: 'blockingTime', valueType: 'ms', subItemsHeading: {key: 'blockingTime'}, granularity: 1, label: str_(i18n.UIStrings.columnBlockingTime)},
219
- /* eslint-enable max-len */
220
- ];
221
-
222
- return {
223
- score: 0,
224
- displayValue: str_(UIStrings.displayValue, {
225
- itemCount: results.length,
226
- }),
227
- details: Audit.makeTableDetails(headings, results),
228
- metricSavings: {TBT: Math.round(tbtImpact)},
229
- };
230
- }
231
- }
232
-
233
- export default ThirdPartyFacades;
234
- export {UIStrings};
@@ -1,13 +0,0 @@
1
- export default DevtoolsLogCompat;
2
- /** @implements {LH.Gatherer.GathererInstance<'DevtoolsLog'>} */
3
- declare class DevtoolsLogCompat extends BaseGatherer implements LH.Gatherer.GathererInstance<"DevtoolsLog"> {
4
- /** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
5
- meta: LH.Gatherer.GathererMeta<"DevtoolsLog">;
6
- /**
7
- * @param {LH.Gatherer.Context<'DevtoolsLog'>} passContext
8
- * @return {Promise<LH.Artifacts['devtoolsLogs']>}
9
- */
10
- getArtifact(passContext: LH.Gatherer.Context<"DevtoolsLog">): Promise<LH.Artifacts["devtoolsLogs"]>;
11
- }
12
- import BaseGatherer from '../base-gatherer.js';
13
- //# sourceMappingURL=devtools-log-compat.d.ts.map
@@ -1,35 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2021 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- /**
8
- * @fileoverview
9
- * This gatherer remaps the result of the DevtoolsLog gatherer for compatibility with legacy Lighthouse
10
- * when devtools logs and traces were special-cased.
11
- */
12
-
13
- import DevtoolsLogGatherer from './devtools-log.js';
14
- import BaseGatherer from '../base-gatherer.js';
15
-
16
- /** @implements {LH.Gatherer.GathererInstance<'DevtoolsLog'>} */
17
- class DevtoolsLogCompat extends BaseGatherer {
18
- /** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
19
- meta = {
20
- supportedModes: ['timespan', 'navigation'],
21
- dependencies: {DevtoolsLog: DevtoolsLogGatherer.symbol},
22
- };
23
-
24
- /**
25
- * @param {LH.Gatherer.Context<'DevtoolsLog'>} passContext
26
- * @return {Promise<LH.Artifacts['devtoolsLogs']>}
27
- */
28
- async getArtifact(passContext) {
29
- return {
30
- defaultPass: passContext.dependencies.DevtoolsLog,
31
- };
32
- }
33
- }
34
-
35
- export default DevtoolsLogCompat;
@@ -1,13 +0,0 @@
1
- export default TraceCompat;
2
- /** @implements {LH.Gatherer.GathererInstance<'Trace'>} */
3
- declare class TraceCompat extends BaseGatherer implements LH.Gatherer.GathererInstance<"Trace"> {
4
- /** @type {LH.Gatherer.GathererMeta<'Trace'>} */
5
- meta: LH.Gatherer.GathererMeta<"Trace">;
6
- /**
7
- * @param {LH.Gatherer.Context<'Trace'>} passContext
8
- * @return {Promise<LH.Artifacts['traces']>}
9
- */
10
- getArtifact(passContext: LH.Gatherer.Context<"Trace">): Promise<LH.Artifacts["traces"]>;
11
- }
12
- import BaseGatherer from '../base-gatherer.js';
13
- //# sourceMappingURL=trace-compat.d.ts.map
@@ -1,35 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2021 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- /**
8
- * @fileoverview
9
- * This gatherer remaps the result of the Trace gatherer for compatibility with legacy Lighthouse
10
- * when devtools logs and traces were special-cased.
11
- */
12
-
13
- import TraceGatherer from './trace.js';
14
- import BaseGatherer from '../base-gatherer.js';
15
-
16
- /** @implements {LH.Gatherer.GathererInstance<'Trace'>} */
17
- class TraceCompat extends BaseGatherer {
18
- /** @type {LH.Gatherer.GathererMeta<'Trace'>} */
19
- meta = {
20
- supportedModes: ['timespan', 'navigation'],
21
- dependencies: {Trace: TraceGatherer.symbol},
22
- };
23
-
24
- /**
25
- * @param {LH.Gatherer.Context<'Trace'>} passContext
26
- * @return {Promise<LH.Artifacts['traces']>}
27
- */
28
- async getArtifact(passContext) {
29
- return {
30
- defaultPass: passContext.dependencies.Trace,
31
- };
32
- }
33
- }
34
-
35
- export default TraceCompat;