Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: apply a few more renames #16270

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/audits/layout-shifts.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class LayoutShifts extends Audit {
static async audit(artifacts, context) {
const trace = artifacts.traces[Audit.DEFAULT_PASS];
const traceEngineResult = await TraceEngineResult.request({trace}, context);
const clusters = traceEngineResult.data.LayoutShifts.clusters ?? [];
const clusters = traceEngineResult.parsedTrace.LayoutShifts.clusters ?? [];
const {cumulativeLayoutShift: clsSavings, impactByNodeId} =
await CumulativeLayoutShiftComputed.request(trace, context);
const traceElements = artifacts.TraceElements
Expand Down
7 changes: 4 additions & 3 deletions core/computed/metrics/lantern-metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ async function getComputationDataParamsFromTrace(data, context) {

const graph = await PageDependencyGraph.request({...data, fromTrace: true}, context);
const traceEngineResult = await TraceEngineResult.request(data, context);
const frameId = traceEngineResult.data.Meta.mainFrameId;
const navigationId = traceEngineResult.data.Meta.mainFrameNavigations[0].args.data.navigationId;
const frameId = traceEngineResult.parsedTrace.Meta.mainFrameId;
const navigationId = traceEngineResult.parsedTrace.Meta.mainFrameNavigations[0]
.args.data.navigationId;
const processedNavigation = Lantern.TraceEngineComputationData.createProcessedNavigation(
traceEngineResult.data, frameId, navigationId);
traceEngineResult.parsedTrace, frameId, navigationId);
const simulator = data.simulator || (await LoadSimulator.request(data, context));

return {simulator, graph, processedNavigation};
Expand Down
6 changes: 3 additions & 3 deletions core/computed/page-dependency-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class PageDependencyGraph {

if (data.fromTrace) {
const traceEngineResult = await TraceEngineResult.request({trace}, context);
const traceEngineData = traceEngineResult.data;
const parsedTrace = traceEngineResult.parsedTrace;
const requests =
Lantern.TraceEngineComputationData.createNetworkRequests(trace, traceEngineData);
Lantern.TraceEngineComputationData.createNetworkRequests(trace, parsedTrace);
const graph =
Lantern.TraceEngineComputationData.createGraph(requests, trace, traceEngineData, URL);
Lantern.TraceEngineComputationData.createGraph(requests, trace, parsedTrace, URL);
// @ts-expect-error for now, ignore that this is a SyntheticNetworkEvent instead of LH's NetworkEvent.
return graph;
}
Expand Down
2 changes: 1 addition & 1 deletion core/computed/trace-engine-result.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TraceEngineResult {
), {});
if (!processor.parsedTrace) throw new Error('No data');
if (!processor.insights) throw new Error('No insights');
return {data: processor.parsedTrace, insights: processor.insights};
return {parsedTrace: processor.parsedTrace, insights: processor.insights};
}

/**
Expand Down
10 changes: 5 additions & 5 deletions core/gather/gatherers/root-causes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class RootCauses extends BaseGatherer {

/**
* @param {LH.Gatherer.Driver} driver
* @param {LH.Artifacts.TraceEngineResult['data']} traceParsedData
* @param {LH.Artifacts.TraceEngineResult['parsedTrace']} parsedTrace
* @return {Promise<LH.Artifacts.TraceEngineRootCauses>}
*/
static async runRootCauseAnalysis(driver, traceParsedData) {
static async runRootCauseAnalysis(driver, parsedTrace) {
await driver.defaultSession.sendCommand('DOM.enable');
await driver.defaultSession.sendCommand('CSS.enable');

Expand Down Expand Up @@ -112,9 +112,9 @@ class RootCauses extends BaseGatherer {
layoutShifts: {},
};
const rootCausesEngine = new TraceEngine.RootCauses(protocolInterface);
const layoutShiftEvents = traceParsedData.LayoutShifts.clusters.flatMap(c => c.events);
const layoutShiftEvents = parsedTrace.LayoutShifts.clusters.flatMap(c => c.events);
for (const event of layoutShiftEvents) {
const r = await rootCausesEngine.layoutShifts.rootCausesForEvent(traceParsedData, event);
const r = await rootCausesEngine.layoutShifts.rootCausesForEvent(parsedTrace, event);
if (!r) continue;

for (const cause of r.fontChanges) {
Expand All @@ -137,7 +137,7 @@ class RootCauses extends BaseGatherer {
async getArtifact(context) {
const trace = context.dependencies.Trace;
const traceEngineResult = await TraceEngineResult.request({trace}, context);
return RootCauses.runRootCauseAnalysis(context.driver, traceEngineResult.data);
return RootCauses.runRootCauseAnalysis(context.driver, traceEngineResult.parsedTrace);
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/gather/gatherers/trace-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class TraceElements extends BaseGatherer {
* that may have caused the shift.
*
* @param {LH.Trace} trace
* @param {LH.Artifacts.TraceEngineResult['data']} traceEngineResult
* @param {LH.Artifacts.TraceEngineResult['parsedTrace']} traceEngineResult
* @param {LH.Artifacts.TraceEngineRootCauses} rootCauses
* @param {LH.Gatherer.Context} context
* @return {Promise<Array<{nodeId: number}>>}
Expand Down Expand Up @@ -322,7 +322,7 @@ class TraceElements extends BaseGatherer {

const lcpNodeData = await TraceElements.getLcpElement(trace, context);
const shiftsData = await TraceElements.getTopLayoutShifts(
trace, traceEngineResult.data, rootCauses, context);
trace, traceEngineResult.parsedTrace, rootCauses, context);
const animatedElementData = await this.getAnimatedElements(mainThreadEvents);
const responsivenessElementData = await TraceElements.getResponsivenessElement(trace, context);

Expand Down
2 changes: 1 addition & 1 deletion types/artifacts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ declare module Artifacts {
}

interface TraceEngineResult {
data: TraceEngine.Handlers.Types.ParsedTrace;
parsedTrace: TraceEngine.Handlers.Types.ParsedTrace;
insights: TraceEngine.Insights.Types.TraceInsightSets;
}

Expand Down
Loading