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

core(lantern): rename files to PascalCase #16068

Merged
merged 4 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions core/audits/byte-efficiency/byte-efficiency-audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {LCPImageRecord} from '../../computed/lcp-image-record.js';

const str_ = i18n.createIcuMessageFn(import.meta.url, {});

/** @typedef {import('../../lib/lantern/simulator/simulator.js').Simulator} Simulator */
/** @typedef {import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
/** @typedef {import('../../lib/lantern/simulator/Simulator.js').Simulator} Simulator */
/** @typedef {import('../../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */

// Parameters for log-normal distribution scoring. These values were determined by fitting the
// log-normal cumulative distribution function curve to the former method of linear interpolation
Expand Down
8 changes: 4 additions & 4 deletions core/audits/byte-efficiency/render-blocking-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import {Audit} from '../audit.js';
import * as i18n from '../../lib/i18n/i18n.js';
import {BaseNode} from '../../lib/lantern/base-node.js';
import {BaseNode} from '../../lib/lantern/BaseNode.js';
import {UnusedCSS} from '../../computed/unused-css.js';
import {NetworkRequest} from '../../lib/network-request.js';
import {LoadSimulator} from '../../computed/load-simulator.js';
Expand All @@ -20,9 +20,9 @@ import {LCPImageRecord} from '../../computed/lcp-image-record.js';
import {NavigationInsights} from '../../computed/navigation-insights.js';


/** @typedef {import('../../lib/lantern/simulator/simulator.js').Simulator} Simulator */
/** @typedef {import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
/** @typedef {import('../../lib/lantern/network-node.js').NetworkNode<LH.Artifacts.NetworkRequest>} NetworkNode */
/** @typedef {import('../../lib/lantern/simulator/Simulator.js').Simulator} Simulator */
/** @typedef {import('../../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */
/** @typedef {import('../../lib/lantern/NetworkNode.js').NetworkNode<LH.Artifacts.NetworkRequest>} NetworkNode */

// Because of the way we detect blocking stylesheets, asynchronously loaded
// CSS with link[rel=preload] and an onload handler (see https://github.com/filamentgroup/loadCSS)
Expand Down
4 changes: 2 additions & 2 deletions core/audits/dobetterweb/uses-http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* origin are over the http/2 protocol.
*/

/** @typedef {import('../../lib/lantern/simulator/simulator.js').Simulator} Simulator */
/** @typedef {import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
/** @typedef {import('../../lib/lantern/simulator/Simulator.js').Simulator} Simulator */
/** @typedef {import('../../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */

import {Audit} from '../audit.js';
import {EntityClassification} from '../../computed/entity-classification.js';
Expand Down
2 changes: 1 addition & 1 deletion core/computed/document-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {NetworkAnalyzer} from '../lib/lantern/simulator/network-analyzer.js';
import {NetworkAnalyzer} from '../lib/lantern/simulator/NetworkAnalyzer.js';
import {makeComputedArtifact} from './computed-artifact.js';
import {NetworkRecords} from './network-records.js';
import {ProcessedTrace} from './processed-trace.js';
Expand Down
2 changes: 1 addition & 1 deletion core/computed/load-simulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import {makeComputedArtifact} from './computed-artifact.js';
import {Simulator} from '../lib/lantern/simulator/simulator.js';
import {Simulator} from '../lib/lantern/simulator/Simulator.js';
import {NetworkAnalysis} from './network-analysis.js';

class LoadSimulator {
Expand Down
2 changes: 1 addition & 1 deletion core/computed/main-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import {makeComputedArtifact} from './computed-artifact.js';
import {NetworkRecords} from './network-records.js';
import {NetworkAnalyzer} from '../lib/lantern/simulator/network-analyzer.js';
import {NetworkAnalyzer} from '../lib/lantern/simulator/NetworkAnalyzer.js';

/**
* @fileoverview This artifact identifies the main resource on the page. Current solution assumes
Expand Down
4 changes: 2 additions & 2 deletions core/computed/metrics/lantern-first-contentful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import {makeComputedArtifact} from '../computed-artifact.js';
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
import {FirstContentfulPaint} from '../../lib/lantern/metrics/first-contentful-paint.js';
import {FirstContentfulPaint} from '../../lib/lantern/metrics/FirstContentfulPaint.js';

/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */

class LanternFirstContentfulPaint extends FirstContentfulPaint {
/**
Expand Down
4 changes: 2 additions & 2 deletions core/computed/metrics/lantern-interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import {makeComputedArtifact} from '../computed-artifact.js';
import {LanternLargestContentfulPaint} from './lantern-largest-contentful-paint.js';
import {Interactive} from '../../lib/lantern/metrics/interactive.js';
import {Interactive} from '../../lib/lantern/metrics/Interactive.js';
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';

/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */

class LanternInteractive extends Interactive {
/**
Expand Down
4 changes: 2 additions & 2 deletions core/computed/metrics/lantern-largest-contentful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

import {makeComputedArtifact} from '../computed-artifact.js';
import {LargestContentfulPaint} from '../../lib/lantern/metrics/largest-contentful-paint.js';
import {LargestContentfulPaint} from '../../lib/lantern/metrics/LargestContentfulPaint.js';
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';

/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */

class LanternLargestContentfulPaint extends LargestContentfulPaint {
/**
Expand Down
4 changes: 2 additions & 2 deletions core/computed/metrics/lantern-max-potential-fid.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

import {makeComputedArtifact} from '../computed-artifact.js';
import {MaxPotentialFID} from '../../lib/lantern/metrics/max-potential-fid.js';
import {MaxPotentialFID} from '../../lib/lantern/metrics/MaxPotentialFID.js';
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';

/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */

class LanternMaxPotentialFID extends MaxPotentialFID {
/**
Expand Down
4 changes: 2 additions & 2 deletions core/computed/metrics/lantern-metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {LanternError} from '../../lib/lantern/lantern-error.js';
import {LanternError} from '../../lib/lantern/LanternError.js';
import {LighthouseError} from '../../lib/lh-error.js';
import {LoadSimulator} from '../load-simulator.js';
import {ProcessedNavigation} from '../processed-navigation.js';
import {PageDependencyGraph} from '../page-dependency-graph.js';
import {TraceEngineResult} from '../trace-engine-result.js';
import {createProcessedNavigation} from '../../lib/lantern/trace-engine-computation-data.js';
import {createProcessedNavigation} from '../../lib/lantern/TraceEngineComputationData.js';

/**
* @param {LH.Artifacts.MetricComputationDataInput} data
Expand Down
4 changes: 2 additions & 2 deletions core/computed/metrics/lantern-speed-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {makeComputedArtifact} from '../computed-artifact.js';
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
import {Speedline} from '../speedline.js';
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
import {SpeedIndex} from '../../lib/lantern/metrics/speed-index.js';
import {SpeedIndex} from '../../lib/lantern/metrics/SpeedIndex.js';

/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */

class LanternSpeedIndex extends SpeedIndex {
/**
Expand Down
4 changes: 2 additions & 2 deletions core/computed/metrics/lantern-total-blocking-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {TotalBlockingTime} from '../../lib/lantern/metrics/total-blocking-time.js';
import {TotalBlockingTime} from '../../lib/lantern/metrics/TotalBlockingTime.js';
import {makeComputedArtifact} from '../computed-artifact.js';
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
import {LanternInteractive} from './lantern-interactive.js';
import {getComputationDataParams} from './lantern-metric.js';

/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */

class LanternTotalBlockingTime extends TotalBlockingTime {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/computed/metrics/total-blocking-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ComputedMetric from './metric.js';
import {TraceProcessor} from '../../lib/tracehouse/trace-processor.js';
import {LanternTotalBlockingTime} from './lantern-total-blocking-time.js';
import {Interactive} from './interactive.js';
import {calculateSumOfBlockingTime} from '../../lib/lantern/tbt-utils.js';
import {calculateSumOfBlockingTime} from '../../lib/lantern/TBTUtils.js';

/**
* @fileoverview This audit determines Total Blocking Time.
Expand Down
2 changes: 1 addition & 1 deletion core/computed/network-analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import {makeComputedArtifact} from './computed-artifact.js';
import {NetworkAnalyzer} from '../lib/lantern/simulator/network-analyzer.js';
import {NetworkAnalyzer} from '../lib/lantern/simulator/NetworkAnalyzer.js';
import {NetworkRecords} from './network-records.js';

class NetworkAnalysis {
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 @@ -5,14 +5,14 @@
*/

import {makeComputedArtifact} from './computed-artifact.js';
import {PageDependencyGraph as LanternPageDependencyGraph} from '../lib/lantern/page-dependency-graph.js';
import {PageDependencyGraph as LanternPageDependencyGraph} from '../lib/lantern/PageDependencyGraph.js';
import {NetworkRequest} from '../lib/network-request.js';
import {ProcessedTrace} from './processed-trace.js';
import {NetworkRecords} from './network-records.js';
import {TraceEngineResult} from './trace-engine-result.js';
import * as TraceEngineComputationData from '../lib/lantern/trace-engine-computation-data.js';
import * as TraceEngineComputationData from '../lib/lantern/TraceEngineComputationData.js';

/** @typedef {import('../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
/** @typedef {import('../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */

class PageDependencyGraph {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/computed/tbt-impact-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {FirstContentfulPaint} from './metrics/first-contentful-paint.js';
import {Interactive} from './metrics/interactive.js';
import {TotalBlockingTime} from './metrics/total-blocking-time.js';
import {ProcessedTrace} from './processed-trace.js';
import {calculateTbtImpactForEvent} from '../lib/lantern/tbt-utils.js';
import {calculateTbtImpactForEvent} from '../lib/lantern/TBTUtils.js';

class TBTImpactTasks {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/lib/asset-saver.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {createGzip, gunzipSync} from 'zlib';

import log from 'lighthouse-logger';

import {Simulator} from './lantern/simulator/simulator.js';
import {Simulator} from './lantern/simulator/Simulator.js';
import lanternTraceSaver from './lantern-trace-saver.js';
import {MetricTraceEvents} from './traces/metric-trace-events.js';
import {NetworkAnalysis} from '../computed/network-analysis.js';
Expand Down
4 changes: 2 additions & 2 deletions core/lib/lantern-trace-saver.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

/** @typedef {import('./lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
/** @typedef {import('./lantern/simulator/simulator.js').CompleteNodeTiming} CompleteNodeTiming */
/** @typedef {import('./lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */
/** @typedef {import('./lantern/simulator/Simulator.js').CompleteNodeTiming} CompleteNodeTiming */

/**
* @param {Map<Node, CompleteNodeTiming>} nodeTimings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* A union of all types derived from BaseNode, allowing type check discrimination
* based on `node.type`. If a new node type is created, it should be added here.
* @template [T=any]
* @typedef {import('./cpu-node.js').CPUNode<T> | import('./network-node.js').NetworkNode<T>} Node
* @typedef {import('./CpuNode.js').CPUNode<T> | import('./NetworkNode.js').NetworkNode<T>} Node
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import * as Lantern from './types/lantern.js';
import {BaseNode} from './base-node.js';
import {BaseNode} from './BaseNode.js';

/**
* @template [T=any]
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions core/lib/lantern/metric.js → core/lib/lantern/Metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

import * as Lantern from './types/lantern.js';
import {BaseNode} from './base-node.js';
import {BaseNode} from './BaseNode.js';
import {RESOURCE_TYPES} from '../network-request.js';

/** @typedef {import('./base-node.js').Node} Node */
/** @typedef {import('./network-node.js').NetworkNode} NetworkNode */
/** @typedef {import('./simulator/simulator.js').Simulator} Simulator */
/** @typedef {import('./BaseNode.js').Node} Node */
/** @typedef {import('./NetworkNode.js').NetworkNode} NetworkNode */
/** @typedef {import('./simulator/Simulator.js').Simulator} Simulator */

/**
* @typedef Extras
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import * as Lantern from './types/lantern.js';
import {NetworkRequestTypes} from './lantern.js';
import {BaseNode} from './base-node.js';
import {BaseNode} from './BaseNode.js';

const NON_NETWORK_SCHEMES = [
'blob', // @see https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import * as Lantern from './types/lantern.js';
import {NetworkRequestTypes} from './lantern.js';
import {NetworkNode} from './network-node.js';
import {CPUNode} from './cpu-node.js';
import {NetworkAnalyzer} from './simulator/network-analyzer.js';
import {NetworkNode} from './NetworkNode.js';
import {CPUNode} from './CpuNode.js';
import {NetworkAnalyzer} from './simulator/NetworkAnalyzer.js';

// COMPAT: m71+ We added RunTask to `disabled-by-default-lighthouse`
const SCHEDULABLE_TASK_TITLE_LH = 'RunTask';
Expand All @@ -19,7 +19,7 @@ const SCHEDULABLE_TASK_TITLE_ALT2 = 'ThreadControllerImpl::DoWork';
// m65 and earlier
const SCHEDULABLE_TASK_TITLE_ALT3 = 'TaskQueueManager::ProcessTaskFromWorkQueue';

/** @typedef {import('./base-node.js').Node} Node */
/** @typedef {import('./BaseNode.js').Node} Node */

/**
* @typedef {Object} NetworkNodeOutput
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as TraceEngine from '@paulirish/trace_engine';
import * as Protocol from '@paulirish/trace_engine/generated/protocol.js';

import * as Lantern from './types/lantern.js';
import {PageDependencyGraph} from './page-dependency-graph.js';
import {PageDependencyGraph} from './PageDependencyGraph.js';
import {RESOURCE_TYPES} from '../network-request.js';

/** @typedef {import('@paulirish/trace_engine/models/trace/handlers/PageLoadMetricsHandler.js').MetricName} MetricName */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

import * as Lantern from '../types/lantern.js';
import {Metric} from '../metric.js';
import {BaseNode} from '../base-node.js';
import {Metric} from '../Metric.js';
import {BaseNode} from '../BaseNode.js';

/** @typedef {import('../base-node.js').Node} Node */
/** @template T @typedef {import('../network-node.js').NetworkNode<T>} NetworkNode */
/** @typedef {import('../cpu-node.js').CPUNode} CpuNode */
/** @typedef {import('../BaseNode.js').Node} Node */
/** @template T @typedef {import('../NetworkNode.js').NetworkNode<T>} NetworkNode */
/** @typedef {import('../CpuNode.js').CPUNode} CpuNode */

class FirstContentfulPaint extends Metric {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

import * as Lantern from '../types/lantern.js';
import {Metric} from '../metric.js';
import {BaseNode} from '../base-node.js';
import {Metric} from '../Metric.js';
import {BaseNode} from '../BaseNode.js';
import {NetworkRequestTypes} from '../lantern.js';

/** @typedef {import('../base-node.js').Node} Node */
/** @typedef {import('../BaseNode.js').Node} Node */

// Any CPU task of 20 ms or more will end up being a critical long task on mobile
const CRITICAL_LONG_TASK_THRESHOLD = 20;
Expand Down Expand Up @@ -62,7 +62,7 @@ class Interactive extends Metric {

/**
* @param {Lantern.Simulation.Result} simulationResult
* @param {import('../metric.js').Extras} extras
* @param {import('../Metric.js').Extras} extras
* @return {Lantern.Simulation.Result}
*/
static getEstimateFromSimulation(simulationResult, extras) {
Expand All @@ -80,7 +80,7 @@ class Interactive extends Metric {

/**
* @param {Lantern.Simulation.MetricComputationDataInput} data
* @param {Omit<import('../metric.js').Extras, 'optimistic'>=} extras
* @param {Omit<import('../Metric.js').Extras, 'optimistic'>=} extras
* @return {Promise<Lantern.Metric>}
*/
static async compute(data, extras) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

import * as Lantern from '../types/lantern.js';
import {Metric} from '../metric.js';
import {FirstContentfulPaint} from './first-contentful-paint.js';
import {LanternError} from '../lantern-error.js';
import {Metric} from '../Metric.js';
import {FirstContentfulPaint} from './FirstContentfulPaint.js';
import {LanternError} from '../LanternError.js';

/** @typedef {import('../base-node.js').Node} Node */
/** @typedef {import('../BaseNode.js').Node} Node */

class LargestContentfulPaint extends Metric {
/**
Expand Down Expand Up @@ -90,7 +90,7 @@ class LargestContentfulPaint extends Metric {

/**
* @param {Lantern.Simulation.MetricComputationDataInput} data
* @param {Omit<import('../metric.js').Extras, 'optimistic'>=} extras
* @param {Omit<import('../Metric.js').Extras, 'optimistic'>=} extras
* @return {Promise<Lantern.Metric>}
*/
static async compute(data, extras) {
Expand Down
Loading
Loading