lighthouse 9.5.0-dev.20220907 → 9.5.0-dev.20220909
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/CONTRIBUTING.md +1 -1
- package/cli/test/smokehouse/core-tests.js +2 -3
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +1 -1
- package/core/audits/bootup-time.js +2 -2
- package/core/audits/byte-efficiency/byte-efficiency-audit.js +7 -6
- package/core/audits/byte-efficiency/duplicated-javascript.js +1 -1
- package/core/audits/byte-efficiency/legacy-javascript.js +2 -2
- package/core/audits/byte-efficiency/offscreen-images.js +2 -2
- package/core/audits/byte-efficiency/render-blocking-resources.js +5 -5
- package/core/audits/byte-efficiency/total-byte-weight.js +1 -1
- package/core/audits/byte-efficiency/unminified-css.js +1 -1
- package/core/audits/byte-efficiency/unused-css-rules.js +1 -1
- package/core/audits/byte-efficiency/unused-javascript.js +4 -4
- package/core/audits/byte-efficiency/uses-long-cache-ttl.js +1 -1
- package/core/audits/byte-efficiency/uses-responsive-images.js +1 -1
- package/core/audits/critical-request-chains.js +1 -1
- package/core/audits/csp-xss.js +1 -1
- package/core/audits/deprecations.js +2 -2
- package/core/audits/diagnostics.js +7 -7
- package/core/audits/dobetterweb/charset.js +1 -1
- package/core/audits/dobetterweb/uses-http2.js +6 -6
- package/core/audits/errors-in-console.js +2 -2
- package/core/audits/final-screenshot.js +2 -2
- package/core/audits/font-display.js +1 -1
- package/core/audits/installable-manifest.js +1 -1
- package/core/audits/is-on-https.js +1 -1
- package/core/audits/long-tasks.js +4 -4
- package/core/audits/main-thread-tasks.js +1 -1
- package/core/audits/mainthread-work-breakdown.js +1 -1
- package/core/audits/maskable-icon.js +1 -1
- package/core/audits/metrics/cumulative-layout-shift.js +1 -1
- package/core/audits/metrics/experimental-interaction-to-next-paint.js +1 -1
- package/core/audits/metrics/first-contentful-paint-3g.js +1 -1
- package/core/audits/metrics/first-contentful-paint.js +1 -1
- package/core/audits/metrics/first-meaningful-paint.js +1 -1
- package/core/audits/metrics/interactive.js +1 -1
- package/core/audits/metrics/largest-contentful-paint.js +1 -1
- package/core/audits/metrics/max-potential-fid.js +1 -1
- package/core/audits/metrics/speed-index.js +1 -1
- package/core/audits/metrics/total-blocking-time.js +1 -1
- package/core/audits/metrics.js +2 -2
- package/core/audits/network-requests.js +2 -2
- package/core/audits/network-rtt.js +3 -3
- package/core/audits/network-server-latency.js +3 -3
- package/core/audits/no-unload-listeners.js +2 -2
- package/core/audits/performance-budget.js +2 -2
- package/core/audits/predictive-perf.js +8 -8
- package/core/audits/preload-fonts.js +1 -1
- package/core/audits/preload-lcp-image.js +4 -4
- package/core/audits/redirects.js +4 -4
- package/core/audits/resource-summary.js +1 -1
- package/core/audits/screenshot-thumbnails.js +1 -1
- package/core/audits/script-treemap-data.js +5 -5
- package/core/audits/seo/canonical.js +1 -1
- package/core/audits/seo/font-size.js +2 -2
- package/core/audits/seo/http-status-code.js +1 -1
- package/core/audits/seo/is-crawlable.js +1 -1
- package/core/audits/seo/tap-targets.js +2 -2
- package/core/audits/server-response-time.js +1 -1
- package/core/audits/splash-screen.js +1 -1
- package/core/audits/themed-omnibox.js +1 -1
- package/core/audits/third-party-facades.js +3 -3
- package/core/audits/third-party-summary.js +2 -2
- package/core/audits/timing-budget.js +2 -2
- package/core/audits/user-timings.js +1 -1
- package/core/audits/uses-rel-preconnect.js +9 -8
- package/core/audits/uses-rel-preload.js +4 -4
- package/core/audits/viewport.js +2 -2
- package/core/audits/violation-audit.js +2 -2
- package/core/audits/work-during-interaction.js +4 -4
- package/core/computed/critical-request-chains.js +5 -3
- package/core/computed/image-records.js +3 -1
- package/core/computed/js-bundles.js +2 -1
- package/core/computed/load-simulator.js +3 -5
- package/core/computed/main-resource.js +3 -2
- package/core/computed/main-thread-tasks.js +3 -2
- package/core/computed/manifest-values.js +3 -1
- package/core/computed/metrics/cumulative-layout-shift.js +3 -2
- package/core/computed/metrics/first-contentful-paint-all-frames.js +3 -2
- package/core/computed/metrics/first-contentful-paint.js +4 -3
- package/core/computed/metrics/first-meaningful-paint.js +4 -3
- package/core/computed/metrics/interactive.js +4 -3
- package/core/computed/metrics/lantern-first-contentful-paint.js +3 -2
- package/core/computed/metrics/lantern-first-meaningful-paint.js +4 -3
- package/core/computed/metrics/lantern-interactive.js +4 -3
- package/core/computed/metrics/lantern-largest-contentful-paint.js +4 -3
- package/core/computed/metrics/lantern-max-potential-fid.js +5 -4
- package/core/computed/metrics/lantern-metric.js +6 -6
- package/core/computed/metrics/lantern-speed-index.js +5 -4
- package/core/computed/metrics/lantern-total-blocking-time.js +5 -4
- package/core/computed/metrics/largest-contentful-paint-all-frames.js +3 -2
- package/core/computed/metrics/largest-contentful-paint.js +4 -3
- package/core/computed/metrics/max-potential-fid.js +4 -3
- package/core/computed/metrics/metric.js +3 -3
- package/core/computed/metrics/navigation-metric.js +4 -3
- package/core/computed/metrics/responsiveness.js +3 -2
- package/core/computed/metrics/speed-index.js +5 -4
- package/core/computed/metrics/timing-summary.js +15 -14
- package/core/computed/metrics/total-blocking-time.js +5 -4
- package/core/computed/module-duplication.js +5 -3
- package/core/computed/network-analysis.js +3 -2
- package/core/computed/network-records.js +2 -1
- package/core/computed/page-dependency-graph.js +13 -11
- package/core/computed/processed-navigation.js +2 -1
- package/core/computed/processed-trace.js +2 -1
- package/core/computed/resource-summary.js +4 -2
- package/core/computed/screenshots.js +2 -1
- package/core/computed/speedline.js +3 -2
- package/core/computed/unused-css.js +3 -2
- package/core/computed/unused-javascript-summary.js +2 -1
- package/core/computed/user-timings.js +3 -2
- package/core/computed/viewport-meta.js +2 -1
- package/core/fraggle-rock/gather/navigation-runner.js +1 -1
- package/core/gather/driver/execution-context.js +1 -1
- package/core/gather/gatherers/accessibility.js +1 -1
- package/core/gather/gatherers/anchor-elements.js +2 -2
- package/core/gather/gatherers/dobetterweb/domstats.js +1 -1
- package/core/gather/gatherers/dobetterweb/optimized-images.js +1 -1
- package/core/gather/gatherers/dobetterweb/password-inputs-with-prevented-paste.js +1 -1
- package/core/gather/gatherers/dobetterweb/response-compression.js +1 -1
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +1 -1
- package/core/gather/gatherers/full-page-screenshot.js +1 -1
- package/core/gather/gatherers/iframe-elements.js +3 -3
- package/core/gather/gatherers/image-elements.js +3 -3
- package/core/gather/gatherers/inputs.js +2 -2
- package/core/gather/gatherers/inspector-issues.js +1 -1
- package/core/gather/gatherers/link-elements.js +2 -2
- package/core/gather/gatherers/main-document-content.js +1 -1
- package/core/gather/gatherers/meta-elements.js +1 -1
- package/core/gather/gatherers/script-elements.js +2 -2
- package/core/gather/gatherers/seo/embedded-content.js +1 -1
- package/core/gather/gatherers/seo/font-size.js +1 -1
- package/core/gather/gatherers/seo/tap-targets.js +1 -1
- package/core/gather/gatherers/trace-elements.js +5 -5
- package/core/index.js +5 -5
- package/core/{config → legacy/config}/config.js +7 -7
- package/core/{config → legacy/config}/legacy-default-config.js +1 -1
- package/core/{gather → legacy/gather}/connections/connection.js +1 -1
- package/core/{gather → legacy/gather}/connections/cri.js +1 -1
- package/core/{gather → legacy/gather}/connections/raw.js +0 -0
- package/core/{gather → legacy/gather}/driver.js +7 -7
- package/core/{gather → legacy/gather}/gather-runner.js +19 -19
- package/core/lib/asset-saver.js +4 -4
- package/core/lib/page-functions.js +11 -18
- package/core/runner.js +5 -4
- package/package.json +2 -2
- package/tsconfig.json +1 -1
- package/types/gatherer.d.ts +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -128,7 +128,7 @@ accept your pull requests.
|
|
|
128
128
|
|
|
129
129
|
## Tracking Errors
|
|
130
130
|
|
|
131
|
-
We track our errors in the wild with Sentry. In general, do not worry about wrapping your audits or gatherers in try/catch blocks and reporting every error that could possibly occur; `core/runner.js` and `core/
|
|
131
|
+
We track our errors in the wild with Sentry. In general, do not worry about wrapping your audits or gatherers in try/catch blocks and reporting every error that could possibly occur; `core/runner.js` and `core/fraggle-rock/gather/*-runner.js` already catch and report any errors that occur while running a gatherer or audit, including errors fatal to the entire run. However, there are some situations when you might want to explicitly handle an error and report it to Sentry or wrap it to avoid reporting. Generally, you can interact with Sentry simply by requiring the `core/lib/sentry.js` file and call its methods. The module exports a delegate that will correctly handle the error reporting based on the user's opt-in preference and will simply no-op if they haven't so you don't need to check.
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
#### If you have an expected error that is recoverable but want to track how frequently it happens, *use Sentry.captureException*.
|
|
@@ -42,7 +42,7 @@ import perfFonts from './test-definitions/perf-fonts.js';
|
|
|
42
42
|
import perfFrameMetrics from './test-definitions/perf-frame-metrics.js';
|
|
43
43
|
import perfPreload from './test-definitions/perf-preload.js';
|
|
44
44
|
import perfTraceElements from './test-definitions/perf-trace-elements.js';
|
|
45
|
-
|
|
45
|
+
import pubads from './test-definitions/pubads.js';
|
|
46
46
|
import pwaAirhorner from './test-definitions/pwa-airhorner.js';
|
|
47
47
|
import pwaCaltrain from './test-definitions/pwa-caltrain.js';
|
|
48
48
|
import pwaChromestatus from './test-definitions/pwa-chromestatus.js';
|
|
@@ -103,8 +103,7 @@ const smokeTests = [
|
|
|
103
103
|
perfFrameMetrics,
|
|
104
104
|
perfPreload,
|
|
105
105
|
perfTraceElements,
|
|
106
|
-
|
|
107
|
-
// pubads,
|
|
106
|
+
pubads,
|
|
108
107
|
pwaAirhorner,
|
|
109
108
|
pwaChromestatus,
|
|
110
109
|
pwaSvgomg,
|
|
@@ -19,7 +19,7 @@ import {once} from 'events';
|
|
|
19
19
|
import puppeteer from 'puppeteer-core';
|
|
20
20
|
import ChromeLauncher from 'chrome-launcher';
|
|
21
21
|
|
|
22
|
-
import {CriConnection} from '../../../../core/gather/connections/cri.js';
|
|
22
|
+
import {CriConnection} from '../../../../core/legacy/gather/connections/cri.js';
|
|
23
23
|
import {LH_ROOT} from '../../../../root.js';
|
|
24
24
|
import {loadArtifacts, saveArtifacts} from '../../../../core/lib/asset-saver.js';
|
|
25
25
|
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import {taskGroups} from '../lib/tracehouse/task-groups.js';
|
|
9
9
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
11
|
-
import MainThreadTasks from '../computed/main-thread-tasks.js';
|
|
10
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
11
|
+
import {MainThreadTasks} from '../computed/main-thread-tasks.js';
|
|
12
12
|
import {getExecutionTimingsByURL} from '../lib/tracehouse/task-summary.js';
|
|
13
13
|
|
|
14
14
|
const UIStrings = {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
8
|
import {linearInterpolation} from '../../lib/statistics.js';
|
|
9
|
-
import
|
|
9
|
+
import {LanternInteractive} from '../../computed/metrics/lantern-interactive.js';
|
|
10
10
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
11
|
-
import NetworkRecords from '../../computed/network-records.js';
|
|
12
|
-
import LoadSimulator from '../../computed/load-simulator.js';
|
|
13
|
-
import PageDependencyGraph from '../../computed/page-dependency-graph.js';
|
|
11
|
+
import {NetworkRecords} from '../../computed/network-records.js';
|
|
12
|
+
import {LoadSimulator} from '../../computed/load-simulator.js';
|
|
13
|
+
import {PageDependencyGraph} from '../../computed/page-dependency-graph.js';
|
|
14
14
|
|
|
15
15
|
const str_ = i18n.createIcuMessageFn(import.meta.url, {});
|
|
16
16
|
|
|
@@ -190,8 +190,9 @@ class ByteEfficiencyAudit extends Audit {
|
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
const savingsOnOverallLoad = simulationBeforeChanges.timeInMs - simulationAfterChanges.timeInMs;
|
|
193
|
-
const savingsOnTTI =
|
|
194
|
-
|
|
193
|
+
const savingsOnTTI =
|
|
194
|
+
LanternInteractive.getLastLongTaskEndTime(simulationBeforeChanges.nodeTimings) -
|
|
195
|
+
LanternInteractive.getLastLongTaskEndTime(simulationAfterChanges.nodeTimings);
|
|
195
196
|
|
|
196
197
|
let savings = savingsOnTTI;
|
|
197
198
|
if (options.includeLoad) savings = Math.max(savings, savingsOnOverallLoad);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
/** @typedef {{url: string, sourceTransferBytes?: number}} SubItem */
|
|
10
10
|
|
|
11
11
|
import {ByteEfficiencyAudit} from './byte-efficiency-audit.js';
|
|
12
|
-
import ModuleDuplication from '../../computed/module-duplication.js';
|
|
12
|
+
import {ModuleDuplication} from '../../computed/module-duplication.js';
|
|
13
13
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
14
14
|
import {getRequestForScript} from '../../lib/script-helpers.js';
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import fs from 'fs';
|
|
21
21
|
|
|
22
22
|
import {ByteEfficiencyAudit} from './byte-efficiency-audit.js';
|
|
23
|
-
import
|
|
23
|
+
import {JSBundles} from '../../computed/js-bundles.js';
|
|
24
24
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
25
25
|
import thirdPartyWeb from '../../lib/third-party-web.js';
|
|
26
26
|
import {getRequestForScript} from '../../lib/script-helpers.js';
|
|
@@ -402,7 +402,7 @@ class LegacyJavascript extends ByteEfficiencyAudit {
|
|
|
402
402
|
*/
|
|
403
403
|
static async audit_(artifacts, networkRecords, context) {
|
|
404
404
|
const mainDocumentEntity = thirdPartyWeb.getEntity(artifacts.URL.finalUrl);
|
|
405
|
-
const bundles = await
|
|
405
|
+
const bundles = await JSBundles.request(artifacts, context);
|
|
406
406
|
|
|
407
407
|
/** @type {Item[]} */
|
|
408
408
|
const items = [];
|
|
@@ -14,8 +14,8 @@ import {NetworkRequest} from '../../lib/network-request.js';
|
|
|
14
14
|
import {Sentry} from '../../lib/sentry.js';
|
|
15
15
|
import UrlUtils from '../../lib/url-utils.js';
|
|
16
16
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
17
|
-
import Interactive from '../../computed/metrics/interactive.js';
|
|
18
|
-
import ProcessedTrace from '../../computed/processed-trace.js';
|
|
17
|
+
import {Interactive} from '../../computed/metrics/interactive.js';
|
|
18
|
+
import {ProcessedTrace} from '../../computed/processed-trace.js';
|
|
19
19
|
|
|
20
20
|
const UIStrings = {
|
|
21
21
|
/** Imperative title of a Lighthouse audit that tells the user to defer loading offscreen images. Offscreen images are images located outside of the visible browser viewport. As they are unseen by the user and slow down page load, they should be loaded later, closer to when the user is going to see them. This is displayed in a list of audit titles that Lighthouse generates. */
|
|
@@ -13,12 +13,12 @@ import {Audit} from '../audit.js';
|
|
|
13
13
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
14
14
|
import {BaseNode} from '../../lib/dependency-graph/base-node.js';
|
|
15
15
|
import {ByteEfficiencyAudit} from './byte-efficiency-audit.js';
|
|
16
|
-
import UnusedCSS from '../../computed/unused-css.js';
|
|
16
|
+
import {UnusedCSS} from '../../computed/unused-css.js';
|
|
17
17
|
import {NetworkRequest} from '../../lib/network-request.js';
|
|
18
|
-
import ProcessedTrace from '../../computed/processed-trace.js';
|
|
19
|
-
import ProcessedNavigation from '../../computed/processed-navigation.js';
|
|
20
|
-
import LoadSimulator from '../../computed/load-simulator.js';
|
|
21
|
-
import FirstContentfulPaint from '../../computed/metrics/first-contentful-paint.js';
|
|
18
|
+
import {ProcessedTrace} from '../../computed/processed-trace.js';
|
|
19
|
+
import {ProcessedNavigation} from '../../computed/processed-navigation.js';
|
|
20
|
+
import {LoadSimulator} from '../../computed/load-simulator.js';
|
|
21
|
+
import {FirstContentfulPaint} from '../../computed/metrics/first-contentful-paint.js';
|
|
22
22
|
|
|
23
23
|
/** @typedef {import('../../lib/dependency-graph/simulator/simulator').Simulator} Simulator */
|
|
24
24
|
/** @typedef {import('../../lib/dependency-graph/base-node.js').Node} Node */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
8
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
9
9
|
import {NetworkRequest} from '../../lib/network-request.js';
|
|
10
|
-
import NetworkRecords from '../../computed/network-records.js';
|
|
10
|
+
import {NetworkRecords} from '../../computed/network-records.js';
|
|
11
11
|
|
|
12
12
|
const UIStrings = {
|
|
13
13
|
/** Title of a diagnostic audit that provides detail on large network resources required during page load. 'Payloads' is roughly equivalent to 'resources'. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {ByteEfficiencyAudit} from './byte-efficiency-audit.js';
|
|
8
|
-
import UnusedCSS from '../../computed/unused-css.js';
|
|
8
|
+
import {UnusedCSS} from '../../computed/unused-css.js';
|
|
9
9
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
10
10
|
import {computeCSSTokenLength as computeTokenLength} from '../../lib/minification-estimator.js';
|
|
11
11
|
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {ByteEfficiencyAudit} from './byte-efficiency-audit.js';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import {UnusedJavascriptSummary} from '../../computed/unused-javascript-summary.js';
|
|
9
|
+
import {JSBundles} from '../../computed/js-bundles.js';
|
|
10
10
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
11
11
|
import {getRequestForScript} from '../../lib/script-helpers.js';
|
|
12
12
|
|
|
@@ -79,7 +79,7 @@ class UnusedJavaScript extends ByteEfficiencyAudit {
|
|
|
79
79
|
* @return {Promise<import('./byte-efficiency-audit.js').ByteEfficiencyProduct>}
|
|
80
80
|
*/
|
|
81
81
|
static async audit_(artifacts, networkRecords, context) {
|
|
82
|
-
const bundles = await
|
|
82
|
+
const bundles = await JSBundles.request(artifacts, context);
|
|
83
83
|
const {
|
|
84
84
|
unusedThreshold = UNUSED_BYTES_IGNORE_THRESHOLD,
|
|
85
85
|
bundleSourceUnusedThreshold = UNUSED_BYTES_IGNORE_BUNDLE_SOURCE_THRESHOLD,
|
|
@@ -95,7 +95,7 @@ class UnusedJavaScript extends ByteEfficiencyAudit {
|
|
|
95
95
|
|
|
96
96
|
const bundle = bundles.find(b => b.script.scriptId === scriptId);
|
|
97
97
|
const unusedJsSummary =
|
|
98
|
-
await
|
|
98
|
+
await UnusedJavascriptSummary.request({scriptId, scriptCoverage, bundle}, context);
|
|
99
99
|
if (unusedJsSummary.wastedBytes === 0 || unusedJsSummary.totalBytes === 0) continue;
|
|
100
100
|
|
|
101
101
|
const transfer = ByteEfficiencyAudit
|
|
@@ -11,7 +11,7 @@ import {NetworkRequest} from '../../lib/network-request.js';
|
|
|
11
11
|
import UrlUtils from '../../lib/url-utils.js';
|
|
12
12
|
import {linearInterpolation} from '../../lib/statistics.js';
|
|
13
13
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
14
|
-
import NetworkRecords from '../../computed/network-records.js';
|
|
14
|
+
import {NetworkRecords} from '../../computed/network-records.js';
|
|
15
15
|
|
|
16
16
|
const UIStrings = {
|
|
17
17
|
/** Title of a diagnostic audit that provides detail on the cache policy applies to the page's static assets. Cache refers to browser disk cache, which keeps old versions of network resources around for future use. This is displayed in a list of audit titles that Lighthouse generates. */
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import {ByteEfficiencyAudit} from './byte-efficiency-audit.js';
|
|
17
17
|
import {NetworkRequest} from '../../lib/network-request.js';
|
|
18
|
-
import ImageRecords from '../../computed/image-records.js';
|
|
18
|
+
import {ImageRecords} from '../../computed/image-records.js';
|
|
19
19
|
import UrlUtils from '../../lib/url-utils.js';
|
|
20
20
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
21
21
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
9
|
-
import ComputedChains from '../computed/critical-request-chains.js';
|
|
9
|
+
import {CriticalRequestChains as ComputedChains} from '../computed/critical-request-chains.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
12
12
|
/** Imperative title of a Lighthouse audit that tells the user to reduce the depth of critical network requests to enhance initial load of a page. Critical request chains are series of dependent network requests that are important for page rendering. For example, here's a 4-request-deep chain: The biglogo.jpg image is required, but is requested via the styles.css style code, which is requested by the initialize.js javascript, which is requested by the page's HTML. This is displayed in a list of audit titles that Lighthouse generates. */
|
package/core/audits/csp-xss.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import MainResource from '../computed/main-resource.js';
|
|
8
|
+
import {MainResource} from '../computed/main-resource.js';
|
|
9
9
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
10
|
import {evaluateRawCspsForXss, getTranslatedDescription} from '../lib/csp-evaluator.js';
|
|
11
11
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import {Audit} from './audit.js';
|
|
12
|
-
import
|
|
12
|
+
import {JSBundles} from '../computed/js-bundles.js';
|
|
13
13
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
14
14
|
import {getIssueDetailDescription} from '../lib/deprecations-strings.js';
|
|
15
15
|
|
|
@@ -56,7 +56,7 @@ class Deprecations extends Audit {
|
|
|
56
56
|
* @return {Promise<LH.Audit.Product>}
|
|
57
57
|
*/
|
|
58
58
|
static async audit(artifacts, context) {
|
|
59
|
-
const bundles = await
|
|
59
|
+
const bundles = await JSBundles.request(artifacts, context);
|
|
60
60
|
|
|
61
61
|
const deprecations = artifacts.InspectorIssues.deprecationIssue
|
|
62
62
|
.map(deprecation => {
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import MainResource from '../computed/main-resource.js';
|
|
8
|
+
import {MainThreadTasks} from '../computed/main-thread-tasks.js';
|
|
9
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
10
|
+
import {NetworkAnalysis} from '../computed/network-analysis.js';
|
|
11
|
+
import {MainResource} from '../computed/main-resource.js';
|
|
12
12
|
|
|
13
13
|
class Diagnostics extends Audit {
|
|
14
14
|
/**
|
|
@@ -33,9 +33,9 @@ class Diagnostics extends Audit {
|
|
|
33
33
|
static async audit(artifacts, context) {
|
|
34
34
|
const trace = artifacts.traces[Audit.DEFAULT_PASS];
|
|
35
35
|
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
|
|
36
|
-
const tasks = await
|
|
37
|
-
const records = await
|
|
38
|
-
const analysis = await
|
|
36
|
+
const tasks = await MainThreadTasks.request(trace, context);
|
|
37
|
+
const records = await NetworkRecords.request(devtoolsLog, context);
|
|
38
|
+
const analysis = await NetworkAnalysis.request(devtoolsLog, context);
|
|
39
39
|
const mainResource = await MainResource.request({devtoolsLog, URL: artifacts.URL}, context);
|
|
40
40
|
|
|
41
41
|
const toplevelTasks = tasks.filter(t => !t.parent);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import {Audit} from '../audit.js';
|
|
16
16
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
17
|
-
import MainResource from '../../computed/main-resource.js';
|
|
17
|
+
import {MainResource} from '../../computed/main-resource.js';
|
|
18
18
|
|
|
19
19
|
const UIStrings = {
|
|
20
20
|
/** Title of a Lighthouse audit that provides detail on if the charset is set properly for a page. This title is shown when the charset is defined correctly. Charset defines the character encoding (eg UTF-8) of the page content. */
|
|
@@ -16,11 +16,11 @@ import {Audit} from '../audit.js';
|
|
|
16
16
|
import ThirdParty from '../../lib/third-party-web.js';
|
|
17
17
|
import UrlUtils from '../../lib/url-utils.js';
|
|
18
18
|
import {ByteEfficiencyAudit} from '../byte-efficiency/byte-efficiency-audit.js';
|
|
19
|
-
import
|
|
19
|
+
import {LanternInteractive} from '../../computed/metrics/lantern-interactive.js';
|
|
20
20
|
import {NetworkRequest} from '../../lib/network-request.js';
|
|
21
|
-
import NetworkRecords from '../../computed/network-records.js';
|
|
22
|
-
import LoadSimulator from '../../computed/load-simulator.js';
|
|
23
|
-
import PageDependencyGraph from '../../computed/page-dependency-graph.js';
|
|
21
|
+
import {NetworkRecords} from '../../computed/network-records.js';
|
|
22
|
+
import {LoadSimulator} from '../../computed/load-simulator.js';
|
|
23
|
+
import {PageDependencyGraph} from '../../computed/page-dependency-graph.js';
|
|
24
24
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
25
25
|
|
|
26
26
|
const UIStrings = {
|
|
@@ -106,8 +106,8 @@ class UsesHTTP2Audit extends Audit {
|
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
const savingsOnOverallLoad = simulationBefore.timeInMs - simulationAfter.timeInMs;
|
|
109
|
-
const savingsOnTTI =
|
|
110
|
-
|
|
109
|
+
const savingsOnTTI = LanternInteractive.getLastLongTaskEndTime(simulationBefore.nodeTimings) -
|
|
110
|
+
LanternInteractive.getLastLongTaskEndTime(simulationAfter.nodeTimings);
|
|
111
111
|
const savings = Math.max(savingsOnTTI, savingsOnOverallLoad);
|
|
112
112
|
|
|
113
113
|
// Round waste to nearest 10ms
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import log from 'lighthouse-logger';
|
|
13
13
|
|
|
14
14
|
import {Audit} from './audit.js';
|
|
15
|
-
import
|
|
15
|
+
import {JSBundles} from '../computed/js-bundles.js';
|
|
16
16
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
17
17
|
|
|
18
18
|
const UIStrings = {
|
|
@@ -81,7 +81,7 @@ class ErrorLogs extends Audit {
|
|
|
81
81
|
static async audit(artifacts, context) {
|
|
82
82
|
/** @type {AuditOptions} */
|
|
83
83
|
const auditOptions = context.options;
|
|
84
|
-
const bundles = await
|
|
84
|
+
const bundles = await JSBundles.request(artifacts, context);
|
|
85
85
|
|
|
86
86
|
/** @type {Array<{source: string, description: string|undefined, sourceLocation: LH.Audit.Details.SourceLocationValue|undefined}>} */
|
|
87
87
|
const consoleRows = artifacts.ConsoleMessages
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import {LighthouseError} from '../lib/lh-error.js';
|
|
9
|
-
import ProcessedTrace from '../computed/processed-trace.js';
|
|
10
|
-
import Screenshots from '../computed/screenshots.js';
|
|
9
|
+
import {ProcessedTrace} from '../computed/processed-trace.js';
|
|
10
|
+
import {Screenshots} from '../computed/screenshots.js';
|
|
11
11
|
|
|
12
12
|
class FinalScreenshot extends Audit {
|
|
13
13
|
/**
|
|
@@ -8,7 +8,7 @@ import {Audit} from './audit.js';
|
|
|
8
8
|
import UrlUtils from '../lib/url-utils.js';
|
|
9
9
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
10
|
import {Sentry} from '../lib/sentry.js';
|
|
11
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
11
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
12
12
|
|
|
13
13
|
const PASSING_FONT_DISPLAY_REGEX = /^(block|fallback|optional|swap)$/;
|
|
14
14
|
const CSS_URL_REGEX = /url\((.*?)\)/;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
9
|
-
import ManifestValues from '../computed/manifest-values.js';
|
|
9
|
+
import {ManifestValues} from '../computed/manifest-values.js';
|
|
10
10
|
|
|
11
11
|
/* eslint-disable max-len */
|
|
12
12
|
const UIStrings = {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import UrlUtils from '../lib/url-utils.js';
|
|
9
9
|
import {NetworkRequest} from '../lib/network-request.js';
|
|
10
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
10
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
11
11
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
12
12
|
|
|
13
13
|
const UIStrings = {
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
8
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
9
9
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
|
-
import MainThreadTasks from '../computed/main-thread-tasks.js';
|
|
11
|
-
import PageDependencyGraph from '../computed/page-dependency-graph.js';
|
|
12
|
-
import LoadSimulator from '../computed/load-simulator.js';
|
|
10
|
+
import {MainThreadTasks} from '../computed/main-thread-tasks.js';
|
|
11
|
+
import {PageDependencyGraph} from '../computed/page-dependency-graph.js';
|
|
12
|
+
import {LoadSimulator} from '../computed/load-simulator.js';
|
|
13
13
|
import {getJavaScriptURLs, getAttributableURLForTask} from '../lib/tracehouse/task-summary.js';
|
|
14
14
|
|
|
15
15
|
/** We don't always have timing data for short tasks, if we're missing timing data. Treat it as though it were 0ms. */
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import {Audit} from './audit.js';
|
|
13
13
|
import {taskGroups} from '../lib/tracehouse/task-groups.js';
|
|
14
14
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
15
|
-
import MainThreadTasks from '../computed/main-thread-tasks.js';
|
|
15
|
+
import {MainThreadTasks} from '../computed/main-thread-tasks.js';
|
|
16
16
|
|
|
17
17
|
const UIStrings = {
|
|
18
18
|
/** Title of a diagnostic audit that provides detail on the main thread work the browser did to load the page. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
|
-
import ComputedCLS from '../../computed/metrics/cumulative-layout-shift.js';
|
|
8
|
+
import {CumulativeLayoutShift as ComputedCLS} from '../../computed/metrics/cumulative-layout-shift.js';
|
|
9
9
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
|
-
import ComputedResponsivenes from '../../computed/metrics/responsiveness.js';
|
|
8
|
+
import {Responsiveness as ComputedResponsivenes} from '../../computed/metrics/responsiveness.js';
|
|
9
9
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
|
-
import ComputedFcp from '../../computed/metrics/first-contentful-paint.js';
|
|
8
|
+
import {FirstContentfulPaint as ComputedFcp} from '../../computed/metrics/first-contentful-paint.js';
|
|
9
9
|
import * as constants from '../../config/constants.js';
|
|
10
10
|
|
|
11
11
|
const regular3G = constants.throttling.mobileRegular3G;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
8
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
9
|
-
import ComputedFcp from '../../computed/metrics/first-contentful-paint.js';
|
|
9
|
+
import {FirstContentfulPaint as ComputedFcp} from '../../computed/metrics/first-contentful-paint.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
12
12
|
/** Description of the First Contentful Paint (FCP) metric, which marks the time at which the first text or image is painted by the browser. This is displayed within a tooltip when the user hovers on the metric name to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
8
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
9
|
-
import ComputedFmp from '../../computed/metrics/first-meaningful-paint.js';
|
|
9
|
+
import {FirstMeaningfulPaint as ComputedFmp} from '../../computed/metrics/first-meaningful-paint.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
12
12
|
/** Description of the First Meaningful Paint (FMP) metric, which marks the time at which a majority of the content has been painted by the browser. This is displayed within a tooltip when the user hovers on the metric name to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
8
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
9
|
-
import Interactive from '../../computed/metrics/interactive.js';
|
|
9
|
+
import {Interactive} from '../../computed/metrics/interactive.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
12
12
|
/** Description of the Time to Interactive (TTI) metric, which evaluates when a page has completed its primary network activity and main thread work. This is displayed within a tooltip when the user hovers on the metric name to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
8
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
9
|
-
import ComputedLcp from '../../computed/metrics/largest-contentful-paint.js';
|
|
9
|
+
import {LargestContentfulPaint as ComputedLcp} from '../../computed/metrics/largest-contentful-paint.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
12
12
|
/** Description of the Largest Contentful Paint (LCP) metric, which marks the time at which the largest text or image is painted by the browser. This is displayed within a tooltip when the user hovers on the metric name to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
|
-
import ComputedFid from '../../computed/metrics/max-potential-fid.js';
|
|
8
|
+
import {MaxPotentialFID as ComputedFid} from '../../computed/metrics/max-potential-fid.js';
|
|
9
9
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
8
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
9
|
-
import ComputedSi from '../../computed/metrics/speed-index.js';
|
|
9
|
+
import {SpeedIndex as ComputedSi} from '../../computed/metrics/speed-index.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
12
12
|
/** Description of the Speed Index metric, which summarizes how quickly the page looked visually complete. This is displayed within a tooltip when the user hovers on the metric name to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
|
-
import ComputedTBT from '../../computed/metrics/total-blocking-time.js';
|
|
8
|
+
import {TotalBlockingTime as ComputedTBT} from '../../computed/metrics/total-blocking-time.js';
|
|
9
9
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
package/core/audits/metrics.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import
|
|
8
|
+
import {TimingSummary} from '../computed/metrics/timing-summary.js';
|
|
9
9
|
|
|
10
10
|
/** @type {Set<keyof LH.Artifacts.TimingSummary>} */
|
|
11
11
|
const DECIMAL_METRIC_KEYS = new Set([
|
|
@@ -42,7 +42,7 @@ class Metrics extends Audit {
|
|
|
42
42
|
const trace = artifacts.traces[Audit.DEFAULT_PASS];
|
|
43
43
|
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
|
|
44
44
|
const URL = artifacts.URL;
|
|
45
|
-
const summary = await
|
|
45
|
+
const summary = await TimingSummary
|
|
46
46
|
.request({trace, devtoolsLog, gatherContext, settings: context.settings, URL}, context);
|
|
47
47
|
const metrics = summary.metrics;
|
|
48
48
|
const debugInfo = summary.debugInfo;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import UrlUtils from '../lib/url-utils.js';
|
|
9
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
10
|
-
import MainResource from '../computed/main-resource.js';
|
|
9
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
10
|
+
import {MainResource} from '../computed/main-resource.js';
|
|
11
11
|
|
|
12
12
|
class NetworkRequests extends Audit {
|
|
13
13
|
/**
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
9
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
10
|
-
import
|
|
9
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
10
|
+
import {NetworkAnalysis} from '../computed/network-analysis.js';
|
|
11
11
|
|
|
12
12
|
const UIStrings = {
|
|
13
13
|
/** Descriptive title of a Lighthouse audit that tells the user the round trip times to each origin the page connected to. This is displayed in a list of audit titles that Lighthouse generates. */
|
|
@@ -49,7 +49,7 @@ class NetworkRTT extends Audit {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const analysis = await
|
|
52
|
+
const analysis = await NetworkAnalysis.request(devtoolsLog, context);
|
|
53
53
|
|
|
54
54
|
/** @type {number} */
|
|
55
55
|
let maxRtt = 0;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
9
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
10
|
-
import
|
|
9
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
10
|
+
import {NetworkAnalysis} from '../computed/network-analysis.js';
|
|
11
11
|
|
|
12
12
|
const UIStrings = {
|
|
13
13
|
/** Descriptive title of a Lighthouse audit that tells the user the server latencies observed from each origin the page connected to. This is displayed in a list of audit titles that Lighthouse generates. */
|
|
@@ -49,7 +49,7 @@ class NetworkServerLatency extends Audit {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const analysis = await
|
|
52
|
+
const analysis = await NetworkAnalysis.request(devtoolsLog, context);
|
|
53
53
|
|
|
54
54
|
/** @type {number} */
|
|
55
55
|
let maxLatency = 0;
|