lighthouse 9.5.0-dev.20220906 → 9.5.0-dev.20220908
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/cli-flags.js +17 -0
- package/cli/run.js +2 -2
- package/cli/test/smokehouse/core-tests.js +2 -3
- package/cli/test/smokehouse/report-assert.js +0 -4
- package/cli/test/smokehouse/smokehouse.js +6 -0
- 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/modern-image-formats.js +5 -5
- package/core/audits/byte-efficiency/offscreen-images.js +4 -4
- 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 +3 -3
- package/core/audits/byte-efficiency/uses-optimized-images.js +5 -5
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +2 -2
- package/core/audits/byte-efficiency/uses-responsive-images.js +3 -3
- package/core/audits/byte-efficiency/uses-text-compression.js +2 -2
- 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 +8 -8
- package/core/audits/errors-in-console.js +2 -2
- package/core/audits/final-screenshot.js +2 -2
- package/core/audits/font-display.js +7 -6
- package/core/audits/image-aspect-ratio.js +3 -3
- package/core/audits/image-size-responsive.js +3 -3
- package/core/audits/installable-manifest.js +1 -1
- package/core/audits/is-on-https.js +3 -3
- 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 +4 -4
- 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 +3 -3
- 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 -2
- package/core/audits/seo/link-text.js +2 -2
- package/core/audits/seo/plugins.js +0 -1
- package/core/audits/seo/robots-txt.js +0 -1
- package/core/audits/seo/tap-targets.js +2 -2
- package/core/audits/server-response-time.js +1 -1
- package/core/audits/service-worker.js +0 -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/unsized-images.js +4 -4
- package/core/audits/user-timings.js +1 -1
- package/core/audits/uses-rel-preconnect.js +12 -10
- package/core/audits/uses-rel-preload.js +6 -6
- 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 +5 -3
- 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 -3
- 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 +3 -3
- package/core/gather/driver/navigation.js +3 -3
- package/core/gather/driver/network-monitor.js +2 -2
- package/core/gather/gather-runner.js +3 -3
- package/core/gather/gatherers/dobetterweb/optimized-images.js +3 -3
- package/core/gather/gatherers/dobetterweb/response-compression.js +3 -3
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +1 -1
- package/core/gather/gatherers/inspector-issues.js +1 -1
- package/core/gather/gatherers/link-elements.js +1 -2
- package/core/gather/gatherers/main-document-content.js +1 -1
- package/core/gather/gatherers/script-elements.js +1 -1
- package/core/gather/gatherers/source-maps.js +0 -1
- package/core/gather/gatherers/trace-elements.js +4 -4
- package/core/index.js +3 -3
- package/core/lib/asset-saver.js +4 -4
- package/core/lib/dependency-graph/simulator/network-analyzer.js +2 -2
- package/core/lib/icons.js +0 -2
- package/core/lib/manifest-parser.js +0 -2
- package/core/lib/network-request.js +7 -7
- package/core/lib/{url-shim.js → url-utils.js} +4 -12
- package/package.json +2 -3
- package/report/test/renderer/performance-category-renderer-test.js +0 -1
- package/report/test/renderer/report-renderer-test.js +0 -1
- package/tsconfig.json +1 -1
- package/core/fraggle-rock/replay/stringify-extension.js +0 -104
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
import {Audit} from './audit.js';
|
|
15
|
-
import
|
|
15
|
+
import UrlUtils from '../lib/url-utils.js';
|
|
16
16
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
17
17
|
|
|
18
18
|
const UIStrings = {
|
|
@@ -54,7 +54,7 @@ class ImageAspectRatio extends Audit {
|
|
|
54
54
|
* @return {{url: string, node: LH.Audit.Details.NodeValue, displayedAspectRatio: string, actualAspectRatio: string, doRatiosMatch: boolean}}
|
|
55
55
|
*/
|
|
56
56
|
static computeAspectRatios(image) {
|
|
57
|
-
const url =
|
|
57
|
+
const url = UrlUtils.elideDataURI(image.src);
|
|
58
58
|
const actualAspectRatio = image.naturalDimensions.width / image.naturalDimensions.height;
|
|
59
59
|
const displayedAspectRatio = image.displayedWidth / image.displayedHeight;
|
|
60
60
|
|
|
@@ -89,7 +89,7 @@ class ImageAspectRatio extends Audit {
|
|
|
89
89
|
// - filter all svgs as they have no natural dimensions to audit
|
|
90
90
|
// - filter out images that have falsy naturalWidth or naturalHeight
|
|
91
91
|
return !image.isCss &&
|
|
92
|
-
|
|
92
|
+
UrlUtils.guessMimeType(image.src) !== 'image/svg+xml' &&
|
|
93
93
|
image.naturalDimensions &&
|
|
94
94
|
image.naturalDimensions.height > 5 &&
|
|
95
95
|
image.naturalDimensions.width > 5 &&
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
import {Audit} from './audit.js';
|
|
14
|
-
import
|
|
14
|
+
import UrlUtils from '../lib/url-utils.js';
|
|
15
15
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
16
16
|
|
|
17
17
|
/** @typedef {LH.Artifacts.ImageElement & Required<Pick<LH.Artifacts.ImageElement, 'naturalDimensions'>>} ImageWithNaturalDimensions */
|
|
@@ -96,7 +96,7 @@ function isCandidate(image) {
|
|
|
96
96
|
) {
|
|
97
97
|
return false;
|
|
98
98
|
}
|
|
99
|
-
if (
|
|
99
|
+
if (UrlUtils.guessMimeType(image.src) === 'image/svg+xml') {
|
|
100
100
|
return false;
|
|
101
101
|
}
|
|
102
102
|
if (image.isCss) {
|
|
@@ -147,7 +147,7 @@ function getResult(image, DPR) {
|
|
|
147
147
|
const [expectedWidth, expectedHeight] =
|
|
148
148
|
expectedImageSize(image.displayedWidth, image.displayedHeight, DPR);
|
|
149
149
|
return {
|
|
150
|
-
url:
|
|
150
|
+
url: UrlUtils.elideDataURI(image.src),
|
|
151
151
|
node: Audit.makeNodeItem(image.node),
|
|
152
152
|
displayedSize: `${image.displayedWidth} x ${image.displayedHeight}`,
|
|
153
153
|
actualSize: `${image.naturalDimensions.width} x ${image.naturalDimensions.height}`,
|
|
@@ -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 = {
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import
|
|
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 = {
|
|
@@ -75,7 +75,7 @@ class HTTPS extends Audit {
|
|
|
75
75
|
return NetworkRecords.request(devtoolsLogs, context).then(networkRecords => {
|
|
76
76
|
const insecureURLs = networkRecords
|
|
77
77
|
.filter(record => !NetworkRequest.isSecureRequest(record))
|
|
78
|
-
.map(record =>
|
|
78
|
+
.map(record => UrlUtils.elideDataURI(record.url));
|
|
79
79
|
|
|
80
80
|
/** @type {Array<{url: string, resolution?: LH.IcuMessage|string}>} */
|
|
81
81
|
const items = Array.from(new Set(insecureURLs)).map(url => ({url, resolution: undefined}));
|
|
@@ -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;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import
|
|
9
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
10
|
-
import MainResource from '../computed/main-resource.js';
|
|
8
|
+
import UrlUtils from '../lib/url-utils.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
|
/**
|
|
@@ -62,7 +62,7 @@ class NetworkRequests extends Audit {
|
|
|
62
62
|
undefined;
|
|
63
63
|
|
|
64
64
|
return {
|
|
65
|
-
url:
|
|
65
|
+
url: UrlUtils.elideDataURI(record.url),
|
|
66
66
|
protocol: record.protocol,
|
|
67
67
|
startTime: timeToMs(record.startTime),
|
|
68
68
|
endTime: timeToMs(record.endTime),
|
|
@@ -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;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import
|
|
8
|
+
import {JSBundles} from '../computed/js-bundles.js';
|
|
9
9
|
import * as i18n from './../lib/i18n/i18n.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
@@ -46,7 +46,7 @@ class NoUnloadListeners extends Audit {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const bundles = await
|
|
49
|
+
const bundles = await JSBundles.request(artifacts, context);
|
|
50
50
|
|
|
51
51
|
/** @type {LH.Audit.Details.Table['headings']} */
|
|
52
52
|
const headings = [
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import ResourceSummary from '../computed/resource-summary.js';
|
|
9
|
-
import MainResource from '../computed/main-resource.js';
|
|
8
|
+
import {ResourceSummary} from '../computed/resource-summary.js';
|
|
9
|
+
import {MainResource} from '../computed/main-resource.js';
|
|
10
10
|
import {Budget} from '../config/budget.js';
|
|
11
11
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
12
12
|
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import LanternInteractive from '../computed/metrics/lantern-interactive.js';
|
|
12
|
-
import LanternSpeedIndex from '../computed/metrics/lantern-speed-index.js';
|
|
13
|
-
import
|
|
9
|
+
import {LanternFirstContentfulPaint} from '../computed/metrics/lantern-first-contentful-paint.js';
|
|
10
|
+
import {LanternFirstMeaningfulPaint} from '../computed/metrics/lantern-first-meaningful-paint.js';
|
|
11
|
+
import {LanternInteractive} from '../computed/metrics/lantern-interactive.js';
|
|
12
|
+
import {LanternSpeedIndex} from '../computed/metrics/lantern-speed-index.js';
|
|
13
|
+
import {LanternLargestContentfulPaint} from '../computed/metrics/lantern-largest-contentful-paint.js';
|
|
14
14
|
|
|
15
15
|
// Parameters (in ms) for log-normal CDF scoring. To see the curve:
|
|
16
16
|
// https://www.desmos.com/calculator/bksgkihhj8
|
|
@@ -50,11 +50,11 @@ class PredictivePerf extends Audit {
|
|
|
50
50
|
// @ts-expect-error - TODO(bckenny): allow optional `throttling` settings
|
|
51
51
|
const settings = {}; // Use default settings.
|
|
52
52
|
const computationData = {trace, devtoolsLog, gatherContext, settings, URL};
|
|
53
|
-
const fcp = await
|
|
54
|
-
const fmp = await
|
|
53
|
+
const fcp = await LanternFirstContentfulPaint.request(computationData, context);
|
|
54
|
+
const fmp = await LanternFirstMeaningfulPaint.request(computationData, context);
|
|
55
55
|
const tti = await LanternInteractive.request(computationData, context);
|
|
56
56
|
const si = await LanternSpeedIndex.request(computationData, context);
|
|
57
|
-
const lcp = await
|
|
57
|
+
const lcp = await LanternLargestContentfulPaint.request(computationData, context);
|
|
58
58
|
|
|
59
59
|
const values = {
|
|
60
60
|
roughEstimateOfFCP: fcp.timing,
|
|
@@ -13,7 +13,7 @@ import {Audit} from './audit.js';
|
|
|
13
13
|
import * as i18n from './../lib/i18n/i18n.js';
|
|
14
14
|
import FontDisplay from './../audits/font-display.js';
|
|
15
15
|
const PASSING_FONT_DISPLAY_REGEX = /^(optional)$/;
|
|
16
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
16
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
17
17
|
|
|
18
18
|
const UIStrings = {
|
|
19
19
|
/** Title of a Lighthouse audit that provides detail on whether fonts that used `font-display: optional` were preloaded. This descriptive title is shown to users when all fonts that used `font-display: optional` were preloaded. */
|
|
@@ -7,9 +7,9 @@
|
|
|
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 MainResource from '../computed/main-resource.js';
|
|
11
|
-
import
|
|
12
|
-
import LoadSimulator from '../computed/load-simulator.js';
|
|
10
|
+
import {MainResource} from '../computed/main-resource.js';
|
|
11
|
+
import {LanternLargestContentfulPaint} from '../computed/metrics/lantern-largest-contentful-paint.js';
|
|
12
|
+
import {LoadSimulator} from '../computed/load-simulator.js';
|
|
13
13
|
import {ByteEfficiencyAudit} from './byte-efficiency/byte-efficiency-audit.js';
|
|
14
14
|
|
|
15
15
|
const UIStrings = {
|
|
@@ -225,7 +225,7 @@ class PreloadLCPImageAudit extends Audit {
|
|
|
225
225
|
|
|
226
226
|
const [mainResource, lanternLCP, simulator] = await Promise.all([
|
|
227
227
|
MainResource.request({devtoolsLog, URL}, context),
|
|
228
|
-
|
|
228
|
+
LanternLargestContentfulPaint.request(metricData, context),
|
|
229
229
|
LoadSimulator.request({devtoolsLog, settings: context.settings}, context),
|
|
230
230
|
]);
|
|
231
231
|
|
package/core/audits/redirects.js
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
8
|
import {ByteEfficiencyAudit} from './byte-efficiency/byte-efficiency-audit.js';
|
|
9
9
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
|
-
import ProcessedTrace from '../computed/processed-trace.js';
|
|
11
|
-
import NetworkRecords from '../computed/network-records.js';
|
|
12
|
-
import MainResource from '../computed/main-resource.js';
|
|
13
|
-
import LanternInteractive from '../computed/metrics/lantern-interactive.js';
|
|
10
|
+
import {ProcessedTrace} from '../computed/processed-trace.js';
|
|
11
|
+
import {NetworkRecords} from '../computed/network-records.js';
|
|
12
|
+
import {MainResource} from '../computed/main-resource.js';
|
|
13
|
+
import {LanternInteractive} from '../computed/metrics/lantern-interactive.js';
|
|
14
14
|
|
|
15
15
|
const UIStrings = {
|
|
16
16
|
/** Imperative title of a Lighthouse audit that tells the user to eliminate the redirects taken through multiple URLs to load the page. This is shown in a list of audits that Lighthouse generates. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from './audit.js';
|
|
8
|
-
import ComputedResourceSummary from '../computed/resource-summary.js';
|
|
8
|
+
import {ResourceSummary as ComputedResourceSummary} from '../computed/resource-summary.js';
|
|
9
9
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
@@ -8,7 +8,7 @@ import jpeg from 'jpeg-js';
|
|
|
8
8
|
|
|
9
9
|
import {Audit} from './audit.js';
|
|
10
10
|
import {LighthouseError} from '../lib/lh-error.js';
|
|
11
|
-
import Speedline from '../computed/speedline.js';
|
|
11
|
+
import {Speedline} from '../computed/speedline.js';
|
|
12
12
|
|
|
13
13
|
const NUMBER_OF_THUMBNAILS = 10;
|
|
14
14
|
const THUMBNAIL_WIDTH = 120;
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {Audit} from './audit.js';
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import ModuleDuplication from '../computed/module-duplication.js';
|
|
18
|
+
import {JSBundles} from '../computed/js-bundles.js';
|
|
19
|
+
import {UnusedJavascriptSummary} from '../computed/unused-javascript-summary.js';
|
|
20
|
+
import {ModuleDuplication} from '../computed/module-duplication.js';
|
|
21
21
|
import {isInline} from '../lib/script-helpers.js';
|
|
22
22
|
|
|
23
23
|
class ScriptTreemapDataAudit extends Audit {
|
|
@@ -167,7 +167,7 @@ class ScriptTreemapDataAudit extends Audit {
|
|
|
167
167
|
const nodes = [];
|
|
168
168
|
/** @type {Map<string, LH.Treemap.Node>} */
|
|
169
169
|
const htmlNodesByFrameId = new Map();
|
|
170
|
-
const bundles = await
|
|
170
|
+
const bundles = await JSBundles.request(artifacts, context);
|
|
171
171
|
const duplicationByPath = await ModuleDuplication.request(artifacts, context);
|
|
172
172
|
|
|
173
173
|
for (const script of artifacts.Scripts) {
|
|
@@ -178,7 +178,7 @@ class ScriptTreemapDataAudit extends Audit {
|
|
|
178
178
|
const scriptCoverage = /** @type {LH.Artifacts['JsUsage'][string] | undefined} */
|
|
179
179
|
(artifacts.JsUsage[script.scriptId]);
|
|
180
180
|
const unusedJavascriptSummary = scriptCoverage ?
|
|
181
|
-
await
|
|
181
|
+
await UnusedJavascriptSummary.request(
|
|
182
182
|
{scriptId: script.scriptId, scriptCoverage, bundle}, context) :
|
|
183
183
|
undefined;
|
|
184
184
|
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
|
-
import
|
|
9
|
-
import MainResource from '../../computed/main-resource.js';
|
|
8
|
+
import UrlUtils from '../../lib/url-utils.js';
|
|
9
|
+
import {MainResource} from '../../computed/main-resource.js';
|
|
10
10
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
11
11
|
|
|
12
12
|
const UIStrings = {
|
|
@@ -93,7 +93,7 @@ class Canonical extends Audit {
|
|
|
93
93
|
// Links that had an hrefRaw but didn't have a valid href were invalid, flag them
|
|
94
94
|
if (!link.href) invalidCanonicalLink = link;
|
|
95
95
|
// Links that had a valid href but didn't have a valid hrefRaw must have been relatively resolved, flag them
|
|
96
|
-
else if (!
|
|
96
|
+
else if (!UrlUtils.isValid(link.hrefRaw)) relativeCanonicallink = link;
|
|
97
97
|
// Otherwise, it was a valid canonical URL
|
|
98
98
|
else uniqueCanonicalURLs.add(link.href);
|
|
99
99
|
} else if (link.rel === 'alternate') {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
10
10
|
import {Audit} from '../audit.js';
|
|
11
|
-
import
|
|
11
|
+
import {ViewportMeta} from '../../computed/viewport-meta.js';
|
|
12
12
|
|
|
13
13
|
const MINIMAL_PERCENTAGE_OF_LEGIBLE_TEXT = 60;
|
|
14
14
|
|
|
@@ -256,7 +256,7 @@ class FontSize extends Audit {
|
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
const viewportMeta = await
|
|
259
|
+
const viewportMeta = await ViewportMeta.request(artifacts.MetaElements, context);
|
|
260
260
|
if (!viewportMeta.isMobileOptimized) {
|
|
261
261
|
return {
|
|
262
262
|
score: 0,
|
|
@@ -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 MainResource from '../../computed/main-resource.js';
|
|
9
|
+
import {MainResource} from '../../computed/main-resource.js';
|
|
10
10
|
|
|
11
11
|
const HTTP_UNSUCCESSFUL_CODE_LOW = 400;
|
|
12
12
|
const HTTP_UNSUCCESSFUL_CODE_HIGH = 599;
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import robotsParser from 'robots-parser';
|
|
8
8
|
|
|
9
9
|
import {Audit} from '../audit.js';
|
|
10
|
-
import
|
|
11
|
-
import MainResource from '../../computed/main-resource.js';
|
|
10
|
+
import {MainResource} from '../../computed/main-resource.js';
|
|
12
11
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
13
12
|
|
|
14
13
|
const BLOCKLIST = new Set([
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audit.js';
|
|
8
|
-
import
|
|
8
|
+
import UrlUtils from '../../lib/url-utils.js';
|
|
9
9
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
10
10
|
|
|
11
11
|
const BLOCKLIST = new Set([
|
|
@@ -121,7 +121,7 @@ class LinkText extends Audit {
|
|
|
121
121
|
href.startsWith('mailto:') ||
|
|
122
122
|
// This line prevents the audit from flagging anchor links.
|
|
123
123
|
// In this case it is better to use `finalUrl` than `mainDocumentUrl`.
|
|
124
|
-
|
|
124
|
+
UrlUtils.equalWithExcludedFragments(link.href, artifacts.URL.finalUrl)
|
|
125
125
|
) {
|
|
126
126
|
return false;
|
|
127
127
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import {Audit} from '../audit.js';
|
|
13
|
-
import
|
|
13
|
+
import {ViewportMeta} from '../../computed/viewport-meta.js';
|
|
14
14
|
import {
|
|
15
15
|
rectsTouchOrOverlap,
|
|
16
16
|
getRectOverlapArea,
|
|
@@ -268,7 +268,7 @@ class TapTargets extends Audit {
|
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
const viewportMeta = await
|
|
271
|
+
const viewportMeta = await ViewportMeta.request(artifacts.MetaElements, context);
|
|
272
272
|
if (!viewportMeta.isMobileOptimized) {
|
|
273
273
|
return {
|
|
274
274
|
score: 0,
|
|
@@ -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 MainResource from '../computed/main-resource.js';
|
|
9
|
+
import {MainResource} from '../computed/main-resource.js';
|
|
10
10
|
|
|
11
11
|
const UIStrings = {
|
|
12
12
|
/** Title of a diagnostic audit that provides detail on how long it took from starting a request to when the server started responding. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
|
|
@@ -4,7 +4,6 @@
|
|
|
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 URL from '../lib/url-shim.js';
|
|
8
7
|
import {Audit} from './audit.js';
|
|
9
8
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
9
|
|