Skip to content

Commit

Permalink
misc(core): reformat to reduce spurious newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Jun 4, 2024
1 parent cc62c81 commit 97e44f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
14 changes: 6 additions & 8 deletions core/audits/byte-efficiency/byte-efficiency-audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {Audit} from '../audit.js';
import * as i18n from '../../lib/i18n/i18n.js';
import {NetworkRecords} from '../../computed/network-records.js';
import {LoadSimulator} from '../../computed/load-simulator.js';
import {LanternLargestContentfulPaint} from '../../computed/metrics/lantern-largest-contentful-paint.js';
import {LanternFirstContentfulPaint} from '../../computed/metrics/lantern-first-contentful-paint.js';
import {LanternLargestContentfulPaint as LanternLCP} from '../../computed/metrics/lantern-largest-contentful-paint.js';
import {LanternFirstContentfulPaint as LanternFCP} from '../../computed/metrics/lantern-first-contentful-paint.js';
import {LCPImageRecord} from '../../computed/lcp-image-record.js';

const str_ = i18n.createIcuMessageFn(import.meta.url, {});
Expand Down Expand Up @@ -171,12 +171,10 @@ class ByteEfficiencyAudit extends Audit {
// This is useful information in the LHR and should be preserved.
let wastedMs;
if (metricComputationInput.gatherContext.gatherMode === 'navigation') {
const {
optimisticGraph: optimisticFCPGraph,
} = await LanternFirstContentfulPaint.request(metricComputationInput, context);
const {
optimisticGraph: optimisticLCPGraph,
} = await LanternLargestContentfulPaint.request(metricComputationInput, context);
const optimisticFCPGraph = (await LanternFCP.request(metricComputationInput, context))
.optimisticGraph;
const optimisticLCPGraph = (await LanternLCP.request(metricComputationInput, context))
.optimisticGraph;

const {savings: fcpSavings} = this.computeWasteWithGraph(
results,
Expand Down
20 changes: 6 additions & 14 deletions core/lib/lantern/metrics/first-contentful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ class FirstContentfulPaint extends Metric {
* @param {FirstPaintBasedGraphOpts<T>} opts
* @return {{definitelyNotRenderBlockingScriptUrls: Set<string>, renderBlockingCpuNodeIds: Set<string>}}
*/
static getRenderBlockingNodeData(
graph,
{cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}
) {
static getRenderBlockingNodeData(graph, opts) {
/** @type {Map<string, CpuNode>} A map of blocking script URLs to the earliest EvaluateScript task node that executed them. */
const scriptUrlToNodeMap = new Map();
const {cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking} =
opts;

/** @type {Array<CpuNode>} */
const cpuNodes = [];
Expand Down Expand Up @@ -135,17 +134,10 @@ class FirstContentfulPaint extends Metric {
* @param {FirstPaintBasedGraphOpts<T>} opts
* @return {Node}
*/
static getFirstPaintBasedGraph(
dependencyGraph,
{cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}
) {
const rbData = this.getRenderBlockingNodeData(dependencyGraph, {
cutoffTimestamp,
treatNodeAsRenderBlocking,
additionalCpuNodesToTreatAsRenderBlocking,
});
static getFirstPaintBasedGraph(dependencyGraph, opts) {
const rbData = this.getRenderBlockingNodeData(dependencyGraph, opts);
const {definitelyNotRenderBlockingScriptUrls, renderBlockingCpuNodeIds} = rbData;

const {cutoffTimestamp, treatNodeAsRenderBlocking} = opts;
return dependencyGraph.cloneWithRelationships(node => {
if (node.type === BaseNode.TYPES.NETWORK) {
// Exclude all nodes that ended after cutoffTimestamp (except for the main document which we always consider necessary)
Expand Down

0 comments on commit 97e44f0

Please sign in to comment.