lighthouse 9.5.0-dev.20230123 → 9.5.0-dev.20230124
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/.codecov.yml +0 -5
- package/core/audits/audit.js +1 -1
- package/core/audits/byte-efficiency/legacy-javascript.d.ts +1 -0
- package/core/audits/byte-efficiency/legacy-javascript.js +7 -3
- package/core/audits/dobetterweb/uses-http2.d.ts +5 -2
- package/core/audits/dobetterweb/uses-http2.js +12 -7
- package/core/audits/third-party-facades.d.ts +3 -2
- package/core/audits/third-party-facades.js +12 -9
- package/core/audits/third-party-summary.d.ts +7 -6
- package/core/audits/third-party-summary.js +16 -14
- package/core/audits/valid-source-maps.d.ts +5 -3
- package/core/audits/valid-source-maps.js +11 -9
- package/core/computed/entity-classification.d.ts +29 -0
- package/core/computed/entity-classification.js +102 -0
- package/core/computed/resource-summary.d.ts +4 -2
- package/core/computed/resource-summary.js +8 -5
- package/core/lib/url-utils.js +1 -1
- package/core/runner.d.ts +10 -0
- package/core/runner.js +48 -0
- package/core/util.cjs +1 -1
- package/dist/report/bundle.esm.js +724 -687
- package/dist/report/flow.js +25 -15
- package/dist/report/standalone.js +25 -15
- package/flow-report/src/common.tsx +1 -1
- package/flow-report/src/i18n/i18n.tsx +17 -16
- package/flow-report/src/sidebar/sidebar.tsx +2 -2
- package/flow-report/src/summary/category.tsx +6 -6
- package/flow-report/src/summary/summary.tsx +2 -2
- package/package.json +4 -4
- package/report/renderer/category-renderer.js +19 -17
- package/report/renderer/crc-details-renderer.js +6 -6
- package/report/renderer/details-renderer.js +7 -6
- package/report/renderer/dom.js +1 -1
- package/report/renderer/element-screenshot-renderer.js +3 -3
- package/report/renderer/performance-category-renderer.js +17 -15
- package/report/renderer/pwa-category-renderer.js +5 -4
- package/report/renderer/report-globals.d.ts +21 -0
- package/report/renderer/report-globals.js +49 -0
- package/report/renderer/report-renderer.js +22 -20
- package/report/renderer/report-ui-features.js +9 -8
- package/report/renderer/report-utils.d.ts +116 -0
- package/report/renderer/{util.js → report-utils.js} +81 -429
- package/report/renderer/snippet-renderer.js +3 -2
- package/report/test/renderer/category-renderer-test.js +9 -4
- package/report/test/renderer/crc-details-renderer-test.js +7 -3
- package/report/test/renderer/details-renderer-test.js +7 -3
- package/report/test/renderer/dom-test.js +7 -3
- package/report/test/renderer/element-screenshot-renderer-test.js +8 -4
- package/report/test/renderer/performance-category-renderer-test.js +14 -9
- package/report/test/renderer/pwa-category-renderer-test.js +10 -5
- package/report/test/renderer/report-renderer-test.js +2 -2
- package/report/test/renderer/report-ui-features-test.js +3 -3
- package/report/test/renderer/{util-test.js → report-utils-test.js} +36 -234
- package/report/test/renderer/snippet-renderer-test.js +7 -3
- package/shared/localization/format.js +5 -2
- package/shared/localization/locales/ar-XB.json +50 -50
- package/shared/localization/locales/ar.json +50 -50
- package/shared/localization/locales/bg.json +50 -50
- package/shared/localization/locales/ca.json +50 -50
- package/shared/localization/locales/cs.json +50 -50
- package/shared/localization/locales/da.json +50 -50
- package/shared/localization/locales/de.json +50 -50
- package/shared/localization/locales/el.json +50 -50
- package/shared/localization/locales/en-GB.json +50 -50
- package/shared/localization/locales/en-US.json +54 -54
- package/shared/localization/locales/en-XA.json +50 -50
- package/shared/localization/locales/en-XL.json +54 -54
- package/shared/localization/locales/es-419.json +50 -50
- package/shared/localization/locales/es.json +50 -50
- package/shared/localization/locales/fi.json +50 -50
- package/shared/localization/locales/fil.json +50 -50
- package/shared/localization/locales/fr.json +50 -50
- package/shared/localization/locales/he.json +50 -50
- package/shared/localization/locales/hi.json +50 -50
- package/shared/localization/locales/hr.json +50 -50
- package/shared/localization/locales/hu.json +50 -50
- package/shared/localization/locales/id.json +50 -50
- package/shared/localization/locales/it.json +50 -50
- package/shared/localization/locales/ja.json +50 -50
- package/shared/localization/locales/ko.json +50 -50
- package/shared/localization/locales/lt.json +50 -50
- package/shared/localization/locales/lv.json +50 -50
- package/shared/localization/locales/nl.json +50 -50
- package/shared/localization/locales/no.json +50 -50
- package/shared/localization/locales/pl.json +50 -50
- package/shared/localization/locales/pt-PT.json +50 -50
- package/shared/localization/locales/pt.json +50 -50
- package/shared/localization/locales/ro.json +50 -50
- package/shared/localization/locales/ru.json +50 -50
- package/shared/localization/locales/sk.json +50 -50
- package/shared/localization/locales/sl.json +50 -50
- package/shared/localization/locales/sr-Latn.json +50 -50
- package/shared/localization/locales/sr.json +50 -50
- package/shared/localization/locales/sv.json +50 -50
- package/shared/localization/locales/ta.json +50 -50
- package/shared/localization/locales/te.json +50 -50
- package/shared/localization/locales/th.json +50 -50
- package/shared/localization/locales/tr.json +50 -50
- package/shared/localization/locales/uk.json +50 -50
- package/shared/localization/locales/vi.json +50 -50
- package/shared/localization/locales/zh-HK.json +50 -50
- package/shared/localization/locales/zh-TW.json +50 -50
- package/shared/localization/locales/zh.json +50 -50
- package/shared/test/util-test.js +214 -0
- package/shared/util.d.ts +122 -0
- package/shared/util.js +332 -0
- package/types/artifacts.d.ts +14 -0
- package/types/lhr/lhr.d.ts +33 -0
- package/report/renderer/util.d.ts +0 -342
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import {EntityClassification} from './entity-classification.js';
|
|
7
8
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
9
|
import {NetworkRecords} from './network-records.js';
|
|
9
10
|
import {NetworkRequest} from '../lib/network-request.js';
|
|
10
11
|
import {Budget} from '../config/budget.js';
|
|
11
|
-
import {Util} from '
|
|
12
|
+
import {Util} from '../../shared/util.js';
|
|
12
13
|
|
|
13
14
|
/** @typedef {{count: number, resourceSize: number, transferSize: number}} ResourceEntry */
|
|
14
15
|
|
|
@@ -35,9 +36,10 @@ class ResourceSummary {
|
|
|
35
36
|
* @param {Array<LH.Artifacts.NetworkRequest>} networkRecords
|
|
36
37
|
* @param {LH.Artifacts.URL} URLArtifact
|
|
37
38
|
* @param {LH.Util.ImmutableObject<LH.Budget[]|null>} budgets
|
|
39
|
+
* @param {LH.Artifacts.EntityClassification} classifiedEntities
|
|
38
40
|
* @return {Record<LH.Budget.ResourceType, ResourceEntry>}
|
|
39
41
|
*/
|
|
40
|
-
static summarize(networkRecords, URLArtifact, budgets) {
|
|
42
|
+
static summarize(networkRecords, URLArtifact, budgets, classifiedEntities) {
|
|
41
43
|
/** @type {Record<LH.Budget.ResourceType, ResourceEntry>} */
|
|
42
44
|
const resourceSummary = {
|
|
43
45
|
'stylesheet': {count: 0, resourceSize: 0, transferSize: 0},
|
|
@@ -56,8 +58,8 @@ class ResourceSummary {
|
|
|
56
58
|
if (budget?.options?.firstPartyHostnames) {
|
|
57
59
|
firstPartyHosts = budget.options.firstPartyHostnames;
|
|
58
60
|
} else {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
firstPartyHosts = classifiedEntities.firstParty?.domains.map(domain => `*.${domain}`) ||
|
|
62
|
+
[`*.${Util.getRootDomain(URLArtifact.finalDisplayedUrl)}`];
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
networkRecords.filter(record => {
|
|
@@ -105,7 +107,8 @@ class ResourceSummary {
|
|
|
105
107
|
*/
|
|
106
108
|
static async compute_(data, context) {
|
|
107
109
|
const networkRecords = await NetworkRecords.request(data.devtoolsLog, context);
|
|
108
|
-
|
|
110
|
+
const classifiedEntities = await EntityClassification.request(data, context);
|
|
111
|
+
return ResourceSummary.summarize(networkRecords, data.URL, data.budgets, classifiedEntities);
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
|
package/core/lib/url-utils.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {Util} from '
|
|
7
|
+
import {Util} from '../../shared/util.js';
|
|
8
8
|
import {LighthouseError} from './lh-error.js';
|
|
9
9
|
|
|
10
10
|
/** @typedef {import('./network-request.js').NetworkRequest} NetworkRequest */
|
package/core/runner.d.ts
CHANGED
|
@@ -16,6 +16,16 @@ export class Runner {
|
|
|
16
16
|
driverMock?: Driver | undefined;
|
|
17
17
|
computedCache: Map<string, ArbitraryEqualityMap>;
|
|
18
18
|
}): Promise<LH.RunnerResult | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* @param {LH.Artifacts} artifacts
|
|
21
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
22
|
+
*/
|
|
23
|
+
static getEntityClassification(artifacts: LH.Artifacts, context: LH.Artifacts.ComputedContext): Promise<{
|
|
24
|
+
list: import("../types/lhr/lhr.js").default.LhrEntity[];
|
|
25
|
+
firstParty: string | undefined;
|
|
26
|
+
entityIndexByOrigin: Record<string, number>;
|
|
27
|
+
entityIndexByName: Record<string, number>;
|
|
28
|
+
} | undefined>;
|
|
19
29
|
/**
|
|
20
30
|
* User can run -G solo, -A solo, or -GA together
|
|
21
31
|
* -G and -A will run partial lighthouse pipelines,
|
package/core/runner.js
CHANGED
|
@@ -23,6 +23,8 @@ import {ReportGenerator} from '../report/generator/report-generator.js';
|
|
|
23
23
|
import {LighthouseError} from './lib/lh-error.js';
|
|
24
24
|
import {lighthouseVersion} from '../root.js';
|
|
25
25
|
import {getModuleDirectory} from '../esm-utils.js';
|
|
26
|
+
import {EntityClassification} from './computed/entity-classification.js';
|
|
27
|
+
import UrlUtils from './lib/url-utils.js';
|
|
26
28
|
|
|
27
29
|
const moduleDir = getModuleDirectory(import.meta);
|
|
28
30
|
|
|
@@ -110,6 +112,7 @@ class Runner {
|
|
|
110
112
|
categories,
|
|
111
113
|
categoryGroups: resolvedConfig.groups || undefined,
|
|
112
114
|
stackPacks: stackPacks.getStackPacks(artifacts.Stacks),
|
|
115
|
+
entities: await Runner.getEntityClassification(artifacts, {computedCache}),
|
|
113
116
|
fullPageScreenshot: resolvedConfig.settings.disableFullPageScreenshot ?
|
|
114
117
|
undefined : artifacts.FullPageScreenshot,
|
|
115
118
|
timing: this._getTiming(artifacts),
|
|
@@ -139,6 +142,51 @@ class Runner {
|
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
|
|
145
|
+
/**
|
|
146
|
+
* @param {LH.Artifacts} artifacts
|
|
147
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
148
|
+
*/
|
|
149
|
+
static async getEntityClassification(artifacts, context) {
|
|
150
|
+
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
|
|
151
|
+
if (!devtoolsLog) return;
|
|
152
|
+
const classifiedEntities = await EntityClassification.request(
|
|
153
|
+
{URL: artifacts.URL, devtoolsLog}, context);
|
|
154
|
+
|
|
155
|
+
/** @type {Array<LH.Result.LhrEntity>} */
|
|
156
|
+
const entities = [];
|
|
157
|
+
/** @type {Record<string, number>} */
|
|
158
|
+
const entityIndexByOrigin = {};
|
|
159
|
+
/** @type {Record<string, number>} */
|
|
160
|
+
const entityIndexByName = {};
|
|
161
|
+
|
|
162
|
+
for (const [entity, entityUrls] of classifiedEntities.urlsByEntity) {
|
|
163
|
+
/** @type {LH.Result.LhrEntity} */
|
|
164
|
+
const shortEntity = {
|
|
165
|
+
name: entity.name,
|
|
166
|
+
homepage: entity.homepage,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// Reduce payload size in LHR JSON by omitting whats falsy.
|
|
170
|
+
if (entity === classifiedEntities.firstParty) shortEntity.isFirstParty = true;
|
|
171
|
+
if (entity.isUnrecognized) shortEntity.isUnrecognized = true;
|
|
172
|
+
|
|
173
|
+
const id = entities.push(shortEntity) - 1;
|
|
174
|
+
for (const url of entityUrls) {
|
|
175
|
+
const origin = UrlUtils.getOrigin(url);
|
|
176
|
+
if (!origin) continue;
|
|
177
|
+
entityIndexByOrigin[origin] = id;
|
|
178
|
+
}
|
|
179
|
+
entityIndexByName[shortEntity.name] = id;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
list: entities,
|
|
184
|
+
firstParty: classifiedEntities.firstParty?.name,
|
|
185
|
+
entityIndexByOrigin,
|
|
186
|
+
entityIndexByName,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
142
190
|
/**
|
|
143
191
|
* User can run -G solo, -A solo, or -GA together
|
|
144
192
|
* -G and -A will run partial lighthouse pipelines,
|
package/core/util.cjs
CHANGED
|
@@ -797,7 +797,7 @@ const UIStrings = {
|
|
|
797
797
|
/** Label for a row in a table that shows the User Agent that was used to send out all network requests during the Lighthouse run. */
|
|
798
798
|
runtimeSettingsUANetwork: 'User agent (network)',
|
|
799
799
|
/** Label for a row in a table that shows the estimated CPU power of the machine running Lighthouse. Example row values: 532, 1492, 783. */
|
|
800
|
-
runtimeSettingsBenchmark: 'CPU/Memory Power',
|
|
800
|
+
runtimeSettingsBenchmark: 'Unthrottled CPU/Memory Power',
|
|
801
801
|
/** Label for a row in a table that shows the version of the Axe library used. Example row values: 2.1.0, 3.2.3 */
|
|
802
802
|
runtimeSettingsAxeVersion: 'Axe version',
|
|
803
803
|
/** Label for a row in a table that shows the screen resolution and DPR that was emulated for the Lighthouse run. Example values: '800x600, DPR: 3' */
|