Skip to content

Commit

Permalink
misc: rename core/gather/computed/ to core/computed/ (#6618)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Nov 20, 2018
1 parent b23c30c commit 34a542a
Show file tree
Hide file tree
Showing 105 changed files with 242 additions and 326 deletions.
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ driver.sendCommand('Security.enable');

## Understanding a Trace

`lighthouse-core/gather/computed/trace-of-tab.js` and `lighthouse-core/lib/traces/tracing-processor.js` provide the core transformation of a trace into more meaningful objects. Each raw trace event has a monotonically increasing timestamp in microseconds, a thread ID, a process ID, a duration in microseconds (potentially), and other applicable metadata properties such as the event type, the task name, the frame, etc. [Learn more about trace events](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview).
`lighthouse-core/computed/trace-of-tab.js` and `lighthouse-core/lib/traces/tracing-processor.js` provide the core transformation of a trace into more meaningful objects. Each raw trace event has a monotonically increasing timestamp in microseconds, a thread ID, a process ID, a duration in microseconds (potentially), and other applicable metadata properties such as the event type, the task name, the frame, etc. [Learn more about trace events](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview).

### Example Trace Event
```js
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/bootup-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const Audit = require('./audit');
const NetworkRequest = require('../lib/network-request');
const {taskGroups} = require('../lib/task-groups');
const i18n = require('../lib/i18n/i18n.js');
const NetworkRecords = require('../gather/computed/network-records.js');
const MainThreadTasks = require('../gather/computed/main-thread-tasks.js');
const NetworkRecords = require('../computed/network-records.js');
const MainThreadTasks = require('../computed/main-thread-tasks.js');

const UIStrings = {
/** Title of a diagnostic audit that provides detail on the time spent executing javascript files during the load. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

const Audit = require('../audit');
const linearInterpolation = require('../../lib/statistics').linearInterpolation;
const Interactive = require('../../gather/computed/metrics/lantern-interactive');
const Interactive = require('../../computed/metrics/lantern-interactive.js');
const i18n = require('../../lib/i18n/i18n.js');
const NetworkRecords = require('../../gather/computed/network-records.js');
const LoadSimulator = require('../../gather/computed/load-simulator.js');
const PageDependencyGraph = require('../../gather/computed/page-dependency-graph.js');
const NetworkRecords = require('../../computed/network-records.js');
const LoadSimulator = require('../../computed/load-simulator.js');
const PageDependencyGraph = require('../../computed/page-dependency-graph.js');

const str_ = i18n.createMessageInstanceIdFn(__filename, {});

Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/byte-efficiency/offscreen-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const ByteEfficiencyAudit = require('./byte-efficiency-audit');
const Sentry = require('../../lib/sentry');
const URL = require('../../lib/url-shim');
const i18n = require('../../lib/i18n/i18n.js');
const Interactive = require('../../gather/computed/metrics/interactive.js');
const TraceOfTab = require('../../gather/computed/trace-of-tab.js');
const Interactive = require('../../computed/metrics/interactive.js');
const TraceOfTab = require('../../computed/trace-of-tab.js');

const UIStrings = {
/** Imperative title of a Lighthouse audit that tells the user to defer loading offscreen images. Offscreen images are images located outside of the visible browser viewport. As they are unseen by the user and slow down page load, they should be loaded later, closer to when the user is going to see them. This is displayed in a list of audit titles that Lighthouse generates. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const BaseNode = require('../../lib/dependency-graph/base-node');
const ByteEfficiencyAudit = require('./byte-efficiency-audit');
const UnusedCSS = require('./unused-css-rules');
const NetworkRequest = require('../../lib/network-request');
const TraceOfTab = require('../../gather/computed/trace-of-tab.js');
const LoadSimulator = require('../../gather/computed/load-simulator.js');
const FirstContentfulPaint = require('../../gather/computed/metrics/first-contentful-paint.js');
const TraceOfTab = require('../../computed/trace-of-tab.js');
const LoadSimulator = require('../../computed/load-simulator.js');
const FirstContentfulPaint = require('../../computed/metrics/first-contentful-paint.js');

/** @typedef {import('../../lib/dependency-graph/simulator/simulator')} Simulator */
/** @typedef {import('../../lib/dependency-graph/base-node.js').Node} Node */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const ByteEfficiencyAudit = require('./byte-efficiency-audit');
const i18n = require('../../lib/i18n/i18n.js');
const NetworkRecords = require('../../gather/computed/network-records.js');
const NetworkRecords = require('../../computed/network-records.js');

const UIStrings = {
/** Title of a diagnostic audit that provides detail on large network resources required during page load. 'Payloads' is roughly equivalent to 'resources'. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const NetworkRequest = require('../../lib/network-request');
const URL = require('../../lib/url-shim');
const linearInterpolation = require('../../lib/statistics').linearInterpolation;
const i18n = require('../../lib/i18n/i18n.js');
const NetworkRecords = require('../../gather/computed/network-records.js');
const NetworkRecords = require('../../computed/network-records.js');

const UIStrings = {
/** Title of a diagnostic audit that provides detail on the cache policy applies to the page's static assets. Cache refers to browser disk cache, which keeps old versions of network resources around for future use. This is displayed in a list of audit titles that Lighthouse generates. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/critical-request-chains.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('./audit');
const i18n = require('../lib/i18n/i18n.js');
const ComputedChains = require('../gather/computed/critical-request-chains.js');
const ComputedChains = require('../computed/critical-request-chains.js');

const UIStrings = {
/** Imperative title of a Lighthouse audit that tells the user to reduce the depth of critical network requests to enhance initial load of a page. Critical request chains are series of dependent network requests that are important for page rendering. For example, here's a 4-request-deep chain: The biglogo.jpg image is required, but is requested via the styles.css style code, which is requested by the initialize.js javascript, which is requested by the page's HTML. This is displayed in a list of audit titles that Lighthouse generates. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/dobetterweb/uses-http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
const URL = require('../../lib/url-shim');
const Audit = require('../audit');
const Util = require('../../report/html/renderer/util.js');
const NetworkRecords = require('../../gather/computed/network-records.js');
const NetworkRecords = require('../../computed/network-records.js');

class UsesHTTP2Audit extends Audit {
/**
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/final-screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('./audit');
const LHError = require('../lib/lh-error');
const Screenshots = require('../gather/computed/screenshots.js');
const Screenshots = require('../computed/screenshots.js');

class FinalScreenshot extends Audit {
/**
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/font-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const CSS_URL_REGEX = /url\((.*?)\)/;
const CSS_URL_GLOBAL_REGEX = new RegExp(CSS_URL_REGEX, 'g');
const i18n = require('../lib/i18n/i18n.js');
const Sentry = require('../lib/sentry.js');
const NetworkRecords = require('../gather/computed/network-records.js');
const NetworkRecords = require('../computed/network-records.js');

const UIStrings = {
/** Title of a diagnostic audit that provides detail on if all the text on a webpage was visible while the page was loading its webfonts. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/is-on-https.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const Audit = require('./audit');
const URL = require('../lib/url-shim');
const Util = require('../report/html/renderer/util');
const NetworkRecords = require('../gather/computed/network-records.js');
const NetworkRecords = require('../computed/network-records.js');

const SECURE_SCHEMES = ['data', 'https', 'wss', 'blob', 'chrome', 'chrome-extension', 'about'];
const SECURE_DOMAINS = ['localhost', '127.0.0.1'];
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/load-fast-enough-for-pwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
const isDeepEqual = require('lodash.isequal');
const Audit = require('./audit');
const mobileThrottling = require('../config/constants').throttling.mobileSlow4G;
const Interactive = require('../gather/computed/metrics/interactive.js');
const Interactive = require('../computed/metrics/interactive.js');

const displayValueText = `Interactive at %d\xa0s`;
const displayValueTextWithOverride = `Interactive on simulated mobile network at %d\xa0s`;
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/mainthread-work-breakdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const Audit = require('./audit');
const {taskGroups} = require('../lib/task-groups');
const i18n = require('../lib/i18n/i18n.js');
const MainThreadTasks = require('../gather/computed/main-thread-tasks.js');
const MainThreadTasks = require('../computed/main-thread-tasks.js');

const UIStrings = {
/** 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. */
Expand Down
16 changes: 8 additions & 8 deletions lighthouse-core/audits/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
'use strict';

const Audit = require('./audit');
const TraceOfTab = require('../gather/computed/trace-of-tab.js');
const Speedline = require('../gather/computed/speedline.js');
const FirstContentfulPaint = require('../gather/computed/metrics/first-contentful-paint.js');
const FirstMeaningfulPaint = require('../gather/computed/metrics/first-meaningful-paint.js');
const FirstCPUIdle = require('../gather/computed/metrics/first-cpu-idle.js');
const Interactive = require('../gather/computed/metrics/interactive.js');
const SpeedIndex = require('../gather/computed/metrics/speed-index.js');
const EstimatedInputLatency = require('../gather/computed/metrics/estimated-input-latency.js');
const TraceOfTab = require('../computed/trace-of-tab.js');
const Speedline = require('../computed/speedline.js');
const FirstContentfulPaint = require('../computed/metrics/first-contentful-paint.js');
const FirstMeaningfulPaint = require('../computed/metrics/first-meaningful-paint.js');
const FirstCPUIdle = require('../computed/metrics/first-cpu-idle.js');
const Interactive = require('../computed/metrics/interactive.js');
const SpeedIndex = require('../computed/metrics/speed-index.js');
const EstimatedInputLatency = require('../computed/metrics/estimated-input-latency.js');

class Metrics extends Audit {
/**
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/metrics/estimated-input-latency.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('../audit');
const i18n = require('../../lib/i18n/i18n.js');
const ComputedEil = require('../../gather/computed/metrics/estimated-input-latency.js');
const ComputedEil = require('../../computed/metrics/estimated-input-latency.js');

const UIStrings = {
/** The name of the metric that marks the estimated time between the page receiving input (a user clicking, tapping, or typing) and the page responding. Shown to users as the label for the numeric metric value. Ideally fits within a ~40 character limit. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/metrics/first-contentful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('../audit');
const i18n = require('../../lib/i18n/i18n.js');
const ComputedFcp = require('../../gather/computed/metrics/first-contentful-paint.js');
const ComputedFcp = require('../../computed/metrics/first-contentful-paint.js');

const UIStrings = {
/** The name of the metric that marks the time at which the first text or image is painted by the browser. Shown to users as the label for the numeric metric value. Ideally fits within a ~40 character limit. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/metrics/first-cpu-idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('../audit');
const i18n = require('../../lib/i18n/i18n.js');
const ComputedFci = require('../../gather/computed/metrics/first-cpu-idle.js');
const ComputedFci = require('../../computed/metrics/first-cpu-idle.js');

const UIStrings = {
/** The name of the metric that marks when the page has displayed content and the CPU is not busy executing the page's scripts. Shown to users as the label for the numeric metric value. Ideally fits within a ~40 character limit. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/metrics/first-meaningful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('../audit');
const i18n = require('../../lib/i18n/i18n.js');
const ComputedFmp = require('../../gather/computed/metrics/first-meaningful-paint.js');
const ComputedFmp = require('../../computed/metrics/first-meaningful-paint.js');

const UIStrings = {
/** The name of the metric that marks the time at which a majority of the content has been painted by the browser. Shown to users as the label for the numeric metric value. Ideally fits within a ~40 character limit. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/metrics/interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('../audit');
const i18n = require('../../lib/i18n/i18n.js');
const Interactive = require('../../gather/computed/metrics/interactive.js');
const Interactive = require('../../computed/metrics/interactive.js');

const UIStrings = {
/** The name of the metric that marks the time at which the page is fully loaded and is able to quickly respond to user input (clicks, taps, and keypresses feel responsive). Shown to users as the label for the numeric metric value. Ideally fits within a ~40 character limit. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/metrics/speed-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('../audit');
const i18n = require('../../lib/i18n/i18n.js');
const ComputedSi = require('../../gather/computed/metrics/speed-index.js');
const ComputedSi = require('../../computed/metrics/speed-index.js');

const UIStrings = {
/** The name of the metric that summarizes how quickly the page looked visually complete. The name of this metric is largely abstract and can be loosely translated. Shown to users as the label for the numeric metric value. Ideally fits within a ~40 character limit. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/mixed-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const Audit = require('./audit');
const URL = require('../lib/url-shim');
const Util = require('../report/html/renderer/util');
const NetworkRecords = require('../gather/computed/network-records.js');
const NetworkRecords = require('../computed/network-records.js');

/**
* This audit checks which resources a page currently loads over HTTP which it
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/network-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('./audit');
const URL = require('../lib/url-shim');
const NetworkRecords = require('../gather/computed/network-records.js');
const NetworkRecords = require('../computed/network-records.js');

class NetworkRequests extends Audit {
/**
Expand Down
12 changes: 6 additions & 6 deletions lighthouse-core/audits/predictive-perf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
const Audit = require('./audit');
const Util = require('../report/html/renderer/util');

const LanternFcp = require('../gather/computed/metrics/lantern-first-contentful-paint.js');
const LanternFmp = require('../gather/computed/metrics/lantern-first-meaningful-paint.js');
const LanternInteractive = require('../gather/computed/metrics/lantern-interactive.js');
const LanternFirstCPUIdle = require('../gather/computed/metrics/lantern-first-cpu-idle.js');
const LanternSpeedIndex = require('../gather/computed/metrics/lantern-speed-index.js');
const LanternEil = require('../gather/computed/metrics/lantern-estimated-input-latency.js');
const LanternFcp = require('../computed/metrics/lantern-first-contentful-paint.js');
const LanternFmp = require('../computed/metrics/lantern-first-meaningful-paint.js');
const LanternInteractive = require('../computed/metrics/lantern-interactive.js');
const LanternFirstCPUIdle = require('../computed/metrics/lantern-first-cpu-idle.js');
const LanternSpeedIndex = require('../computed/metrics/lantern-speed-index.js');
const LanternEil = require('../computed/metrics/lantern-estimated-input-latency.js');

// Parameters (in ms) for log-normal CDF scoring. To see the curve:
// https://www.desmos.com/calculator/rjp0lbit8y
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
const Audit = require('./audit');
const UnusedBytes = require('./byte-efficiency/byte-efficiency-audit');
const i18n = require('../lib/i18n/i18n.js');
const TraceOfTab = require('../gather/computed/trace-of-tab.js');
const NetworkRecords = require('../gather/computed/network-records.js');
const MainResource = require('../gather/computed/main-resource.js');
const LanternInteractive = require('../gather/computed/metrics/lantern-interactive.js');
const TraceOfTab = require('../computed/trace-of-tab.js');
const NetworkRecords = require('../computed/network-records.js');
const MainResource = require('../computed/main-resource.js');
const LanternInteractive = require('../computed/metrics/lantern-interactive.js');

const UIStrings = {
/** 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. */
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/screenshot-thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
const Audit = require('./audit');
const LHError = require('../lib/lh-error');
const jpeg = require('jpeg-js');
const Speedline = require('../gather/computed/speedline.js');
const Interactive = require('../gather/computed/metrics/interactive.js');
const Speedline = require('../computed/speedline.js');
const Interactive = require('../computed/metrics/interactive.js');

const NUMBER_OF_THUMBNAILS = 10;
const THUMBNAIL_WIDTH = 120;
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/seo/canonical.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const Audit = require('../audit');
const LinkHeader = require('http-link-header');
const URL = require('../../lib/url-shim');
const MainResource = require('../../gather/computed/main-resource.js');
const MainResource = require('../../computed/main-resource.js');
const LINK_HEADER = 'link';

/**
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/seo/hreflang.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('../audit');
const LinkHeader = require('http-link-header');
const MainResource = require('../../gather/computed/main-resource.js');
const MainResource = require('../../computed/main-resource.js');
const VALID_LANGS = importValidLangs();
const LINK_HEADER = 'link';
const NO_LANGUAGE = 'x-default';
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/seo/http-status-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'use strict';

const Audit = require('../audit');
const MainResource = require('../../gather/computed/main-resource.js');
const MainResource = require('../../computed/main-resource.js');
const HTTP_UNSUCCESSFUL_CODE_LOW = 400;
const HTTP_UNSUCCESSFUL_CODE_HIGH = 599;

Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/seo/is-crawlable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const Audit = require('../audit');
const robotsParser = require('robots-parser');
const URL = require('../../lib/url-shim');
const MainResource = require('../../gather/computed/main-resource.js');
const MainResource = require('../../computed/main-resource.js');
const BLOCKLIST = new Set([
'noindex',
'none',
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/splash-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'use strict';

const MultiCheckAudit = require('./multi-check-audit');
const ManifestValues = require('../gather/computed/manifest-values');
const ManifestValues = require('../computed/manifest-values.js');

/**
* @fileoverview
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/themed-omnibox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'use strict';

const MultiCheckAudit = require('./multi-check-audit');
const ManifestValues = require('../gather/computed/manifest-values');
const ManifestValues = require('../computed/manifest-values.js');
const cssParsers = require('cssstyle/lib/parsers');

/**
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/time-to-first-byte.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('./audit');
const i18n = require('../lib/i18n/i18n.js');
const MainResource = require('../gather/computed/main-resource.js');
const MainResource = require('../computed/main-resource.js');

const UIStrings = {
/** 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. */
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/user-timings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const Audit = require('./audit');
const i18n = require('../lib/i18n/i18n.js');
const TraceOfTab = require('../gather/computed/trace-of-tab.js');
const TraceOfTab = require('../computed/trace-of-tab.js');

const UIStrings = {
/** Descriptive title of a diagnostic audit that provides details on any timestamps generated by the page. User Timing refers to the 'User Timing API', which enables a website to record specific times as 'marks', or spans of time as 'measures'. */
Expand Down

0 comments on commit 34a542a

Please sign in to comment.