Skip to content

Commit

Permalink
apply a few more parsedTrace renames
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Dec 3, 2024
1 parent fa2b268 commit 485d052
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
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
6 changes: 3 additions & 3 deletions core/computed/metrics/lantern-metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ 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
2 changes: 1 addition & 1 deletion core/computed/page-dependency-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PageDependencyGraph {

if (data.fromTrace) {
const traceEngineResult = await TraceEngineResult.request({trace}, context);
const parsedTrace = traceEngineResult.data;
const parsedTrace = traceEngineResult.parsedTrace;
const requests =
Lantern.TraceEngineComputationData.createNetworkRequests(trace, parsedTrace);
const 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
4 changes: 2 additions & 2 deletions core/gather/gatherers/root-causes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RootCauses extends BaseGatherer {

/**
* @param {LH.Gatherer.Driver} driver
* @param {LH.Artifacts.TraceEngineResult['data']} parsedTrace
* @param {LH.Artifacts.TraceEngineResult['parsedTrace']} parsedTrace
* @return {Promise<LH.Artifacts.TraceEngineRootCauses>}
*/
static async runRootCauseAnalysis(driver, parsedTrace) {
Expand Down Expand Up @@ -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
3 changes: 1 addition & 2 deletions types/artifacts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,7 @@ declare module Artifacts {
}

interface TraceEngineResult {
// TODO: rename to paredtrace
data: TraceEngine.Handlers.Types.ParsedTrace;
parsedTrace: TraceEngine.Handlers.Types.ParsedTrace;
insights: TraceEngine.Insights.Types.TraceInsightSets;
}

Expand Down

0 comments on commit 485d052

Please sign in to comment.