From 34a542a156b271fd7725525b09a92a344d7809c0 Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Tue, 20 Nov 2018 15:30:42 -0800 Subject: [PATCH] misc: rename core/gather/computed/ to core/computed/ (#6618) --- docs/architecture.md | 2 +- lighthouse-core/audits/bootup-time.js | 4 +- .../byte-efficiency/byte-efficiency-audit.js | 8 +- .../byte-efficiency/offscreen-images.js | 4 +- .../render-blocking-resources.js | 6 +- .../byte-efficiency/total-byte-weight.js | 2 +- .../byte-efficiency/uses-long-cache-ttl.js | 2 +- .../audits/critical-request-chains.js | 2 +- .../audits/dobetterweb/uses-http2.js | 2 +- lighthouse-core/audits/final-screenshot.js | 2 +- lighthouse-core/audits/font-display.js | 2 +- lighthouse-core/audits/is-on-https.js | 2 +- .../audits/load-fast-enough-for-pwa.js | 2 +- .../audits/mainthread-work-breakdown.js | 2 +- lighthouse-core/audits/metrics.js | 16 ++-- .../audits/metrics/estimated-input-latency.js | 2 +- .../audits/metrics/first-contentful-paint.js | 2 +- .../audits/metrics/first-cpu-idle.js | 2 +- .../audits/metrics/first-meaningful-paint.js | 2 +- lighthouse-core/audits/metrics/interactive.js | 2 +- lighthouse-core/audits/metrics/speed-index.js | 2 +- lighthouse-core/audits/mixed-content.js | 2 +- lighthouse-core/audits/network-requests.js | 2 +- lighthouse-core/audits/predictive-perf.js | 12 +-- lighthouse-core/audits/redirects.js | 8 +- .../audits/screenshot-thumbnails.js | 4 +- lighthouse-core/audits/seo/canonical.js | 2 +- lighthouse-core/audits/seo/hreflang.js | 2 +- .../audits/seo/http-status-code.js | 2 +- lighthouse-core/audits/seo/is-crawlable.js | 2 +- lighthouse-core/audits/splash-screen.js | 2 +- lighthouse-core/audits/themed-omnibox.js | 2 +- lighthouse-core/audits/time-to-first-byte.js | 2 +- lighthouse-core/audits/user-timings.js | 2 +- lighthouse-core/audits/uses-rel-preconnect.js | 6 +- lighthouse-core/audits/uses-rel-preload.js | 8 +- .../audits/webapp-install-banner.js | 2 +- .../computed-artifact.js} | 2 +- .../computed/critical-request-chains.js | 4 +- .../{gather => }/computed/load-simulator.js | 8 +- .../{gather => }/computed/main-resource.js | 4 +- .../computed/main-thread-tasks.js | 6 +- .../{gather => }/computed/manifest-values.js | 4 +- .../metrics/estimated-input-latency.js | 8 +- .../metrics/first-contentful-paint.js | 4 +- .../computed/metrics/first-cpu-idle.js | 8 +- .../metrics/first-meaningful-paint.js | 6 +- .../computed/metrics/interactive.js | 8 +- .../lantern-estimated-input-latency.js | 8 +- .../metrics/lantern-first-contentful-paint.js | 6 +- .../metrics/lantern-first-cpu-idle.js | 6 +- .../metrics/lantern-first-meaningful-paint.js | 6 +- .../computed/metrics/lantern-interactive.js | 6 +- .../computed/metrics/lantern-metric.js | 8 +- .../computed/metrics/lantern-speed-index.js | 6 +- .../{gather => }/computed/metrics/metric.js | 2 +- .../computed/metrics/speed-index.js | 4 +- .../{gather => }/computed/network-analysis.js | 4 +- .../{gather => }/computed/network-records.js | 4 +- .../computed/page-dependency-graph.js | 14 ++-- .../{gather => }/computed/pushed-requests.js | 2 +- .../{gather => }/computed/screenshots.js | 2 +- .../{gather => }/computed/speedline.js | 4 +- .../{gather => }/computed/trace-of-tab.js | 8 +- .../gather/computed/computed-artifact.js | 76 ------------------- .../scripts/lantern/minify-trace.js | 4 +- .../byte-efficiency-audit-test.js | 4 +- .../computed/computed-artifact-test.js | 42 +++++----- .../computed/critical-request-chains-test.js | 12 +-- .../computed/load-simulator-test.js | 4 +- .../computed/main-resource-test.js | 6 +- .../computed/main-thread-tasks-test.js | 8 +- .../computed/manifest-values-test.js | 6 +- .../estimated-input-latency-test.js.snap | 0 .../first-contentful-paint-test.js.snap | 0 .../__snapshots__/first-cpu-idle-test.js.snap | 0 .../first-meaningful-paint-test.js.snap | 0 .../__snapshots__/interactive-test.js.snap | 0 ...ntern-estimated-input-latency-test.js.snap | 0 ...antern-first-contentful-paint-test.js.snap | 0 .../lantern-first-cpu-idle-test.js.snap | 0 ...antern-first-meaningful-paint-test.js.snap | 0 .../lantern-interactive-test.js.snap | 0 .../lantern-speed-index-test.js.snap | 0 .../__snapshots__/speed-index-test.js.snap | 0 .../metrics/estimated-input-latency-test.js | 6 +- .../metrics/first-contentful-paint-test.js | 6 +- .../computed/metrics/first-cpu-idle-test.js | 12 +-- .../metrics/first-meaningful-paint-test.js | 4 +- .../computed/metrics/interactive-test.js | 6 +- .../lantern-estimated-input-latency-test.js | 6 +- .../lantern-first-contentful-paint-test.js | 6 +- .../metrics/lantern-first-cpu-idle-test.js | 6 +- .../lantern-first-meaningful-paint-test.js | 6 +- .../metrics/lantern-interactive-test.js | 6 +- .../metrics/lantern-speed-index-test.js | 6 +- .../computed/metrics/speed-index-test.js | 6 +- .../computed/page-dependency-graph-test.js | 10 +-- .../{gather => }/computed/screenshots-test.js | 4 +- .../{gather => }/computed/speedline-test.js | 8 +- .../computed/trace-of-tab-test.js | 18 ++--- .../simulator/network-analyzer-test.js | 2 +- .../simulator/simulator-test.js | 2 +- .../test/lib/traces/tracing-processor-test.js | 2 +- types/artifacts.d.ts | 2 +- 105 files changed, 242 insertions(+), 326 deletions(-) rename lighthouse-core/{gather/computed/new-computed-artifact.js => computed/computed-artifact.js} (96%) rename lighthouse-core/{gather => }/computed/critical-request-chains.js (97%) rename lighthouse-core/{gather => }/computed/load-simulator.js (89%) rename lighthouse-core/{gather => }/computed/main-resource.js (93%) rename lighthouse-core/{gather => }/computed/main-thread-tasks.js (97%) rename lighthouse-core/{gather => }/computed/manifest-values.js (97%) rename lighthouse-core/{gather => }/computed/metrics/estimated-input-latency.js (91%) rename lighthouse-core/{gather => }/computed/metrics/first-contentful-paint.js (92%) rename lighthouse-core/{gather => }/computed/metrics/first-cpu-idle.js (97%) rename lighthouse-core/{gather => }/computed/metrics/first-meaningful-paint.js (90%) rename lighthouse-core/{gather => }/computed/metrics/interactive.js (96%) rename lighthouse-core/{gather => }/computed/metrics/lantern-estimated-input-latency.js (94%) rename lighthouse-core/{gather => }/computed/metrics/lantern-first-contentful-paint.js (93%) rename lighthouse-core/{gather => }/computed/metrics/lantern-first-cpu-idle.js (92%) rename lighthouse-core/{gather => }/computed/metrics/lantern-first-meaningful-paint.js (95%) rename lighthouse-core/{gather => }/computed/metrics/lantern-interactive.js (95%) rename lighthouse-core/{gather => }/computed/metrics/lantern-metric.js (94%) rename lighthouse-core/{gather => }/computed/metrics/lantern-speed-index.js (95%) rename lighthouse-core/{gather => }/computed/metrics/metric.js (97%) rename lighthouse-core/{gather => }/computed/metrics/speed-index.js (93%) rename lighthouse-core/{gather => }/computed/network-analysis.js (94%) rename lighthouse-core/{gather => }/computed/network-records.js (87%) rename lighthouse-core/{gather => }/computed/page-dependency-graph.js (96%) rename lighthouse-core/{gather => }/computed/pushed-requests.js (94%) rename lighthouse-core/{gather => }/computed/screenshots.js (94%) rename lighthouse-core/{gather => }/computed/speedline.js (94%) rename lighthouse-core/{gather => }/computed/trace-of-tab.js (97%) delete mode 100644 lighthouse-core/gather/computed/computed-artifact.js rename lighthouse-core/test/{gather => }/computed/computed-artifact-test.js (51%) rename lighthouse-core/test/{gather => }/computed/critical-request-chains-test.js (96%) rename lighthouse-core/test/{gather => }/computed/load-simulator-test.js (93%) rename lighthouse-core/test/{gather => }/computed/main-resource-test.js (91%) rename lighthouse-core/test/{gather => }/computed/main-thread-tasks-test.js (95%) rename lighthouse-core/test/{gather => }/computed/manifest-values-test.js (97%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/estimated-input-latency-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/first-contentful-paint-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/first-cpu-idle-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/first-meaningful-paint-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/interactive-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/lantern-estimated-input-latency-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/lantern-first-contentful-paint-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/lantern-first-cpu-idle-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/lantern-first-meaningful-paint-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/lantern-interactive-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/lantern-speed-index-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/__snapshots__/speed-index-test.js.snap (100%) rename lighthouse-core/test/{gather => }/computed/metrics/estimated-input-latency-test.js (89%) rename lighthouse-core/test/{gather => }/computed/metrics/first-contentful-paint-test.js (85%) rename lighthouse-core/test/{gather => }/computed/metrics/first-cpu-idle-test.js (94%) rename lighthouse-core/test/{gather => }/computed/metrics/first-meaningful-paint-test.js (95%) rename lighthouse-core/test/{gather => }/computed/metrics/interactive-test.js (96%) rename lighthouse-core/test/{gather => }/computed/metrics/lantern-estimated-input-latency-test.js (78%) rename lighthouse-core/test/{gather => }/computed/metrics/lantern-first-contentful-paint-test.js (82%) rename lighthouse-core/test/{gather => }/computed/metrics/lantern-first-cpu-idle-test.js (87%) rename lighthouse-core/test/{gather => }/computed/metrics/lantern-first-meaningful-paint-test.js (85%) rename lighthouse-core/test/{gather => }/computed/metrics/lantern-interactive-test.js (82%) rename lighthouse-core/test/{gather => }/computed/metrics/lantern-speed-index-test.js (79%) rename lighthouse-core/test/{gather => }/computed/metrics/speed-index-test.js (85%) rename lighthouse-core/test/{gather => }/computed/page-dependency-graph-test.js (96%) rename lighthouse-core/test/{gather => }/computed/screenshots-test.js (89%) rename lighthouse-core/test/{gather => }/computed/speedline-test.js (92%) rename lighthouse-core/test/{gather => }/computed/trace-of-tab-test.js (91%) diff --git a/docs/architecture.md b/docs/architecture.md index a21b9db4efbf..2795c7900c32 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -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 diff --git a/lighthouse-core/audits/bootup-time.js b/lighthouse-core/audits/bootup-time.js index 3bdbb2afc2e2..1c74d3ac0141 100644 --- a/lighthouse-core/audits/bootup-time.js +++ b/lighthouse-core/audits/bootup-time.js @@ -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. */ diff --git a/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js b/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js index ade9fc7881f5..4d90e2e2475e 100644 --- a/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +++ b/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js @@ -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, {}); diff --git a/lighthouse-core/audits/byte-efficiency/offscreen-images.js b/lighthouse-core/audits/byte-efficiency/offscreen-images.js index 0d1032fe0afe..305e0a558dda 100644 --- a/lighthouse-core/audits/byte-efficiency/offscreen-images.js +++ b/lighthouse-core/audits/byte-efficiency/offscreen-images.js @@ -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. */ diff --git a/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js b/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js index 23482a7e4e93..62d1bde7d2da 100644 --- a/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +++ b/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js @@ -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 */ diff --git a/lighthouse-core/audits/byte-efficiency/total-byte-weight.js b/lighthouse-core/audits/byte-efficiency/total-byte-weight.js index a8f068c3c269..1a796153e1b8 100644 --- a/lighthouse-core/audits/byte-efficiency/total-byte-weight.js +++ b/lighthouse-core/audits/byte-efficiency/total-byte-weight.js @@ -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. */ diff --git a/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js b/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js index 5bd1548f39ae..c00c19a47177 100644 --- a/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js +++ b/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js @@ -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. */ diff --git a/lighthouse-core/audits/critical-request-chains.js b/lighthouse-core/audits/critical-request-chains.js index e92990877ce5..dbf6f0a33e17 100644 --- a/lighthouse-core/audits/critical-request-chains.js +++ b/lighthouse-core/audits/critical-request-chains.js @@ -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. */ diff --git a/lighthouse-core/audits/dobetterweb/uses-http2.js b/lighthouse-core/audits/dobetterweb/uses-http2.js index 3e98dcef2d68..fd11ed12c38f 100644 --- a/lighthouse-core/audits/dobetterweb/uses-http2.js +++ b/lighthouse-core/audits/dobetterweb/uses-http2.js @@ -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 { /** diff --git a/lighthouse-core/audits/final-screenshot.js b/lighthouse-core/audits/final-screenshot.js index e5a6264d1c8f..9fae0b6479ce 100644 --- a/lighthouse-core/audits/final-screenshot.js +++ b/lighthouse-core/audits/final-screenshot.js @@ -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 { /** diff --git a/lighthouse-core/audits/font-display.js b/lighthouse-core/audits/font-display.js index 1e40089f34ad..c0ae9b09cf94 100644 --- a/lighthouse-core/audits/font-display.js +++ b/lighthouse-core/audits/font-display.js @@ -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. */ diff --git a/lighthouse-core/audits/is-on-https.js b/lighthouse-core/audits/is-on-https.js index 7ee38f7e2cb0..ccdecf0e0e17 100644 --- a/lighthouse-core/audits/is-on-https.js +++ b/lighthouse-core/audits/is-on-https.js @@ -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']; diff --git a/lighthouse-core/audits/load-fast-enough-for-pwa.js b/lighthouse-core/audits/load-fast-enough-for-pwa.js index d447a8035d4a..dc16cb47a248 100644 --- a/lighthouse-core/audits/load-fast-enough-for-pwa.js +++ b/lighthouse-core/audits/load-fast-enough-for-pwa.js @@ -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`; diff --git a/lighthouse-core/audits/mainthread-work-breakdown.js b/lighthouse-core/audits/mainthread-work-breakdown.js index 42c8938fba4f..9ebb5686323c 100644 --- a/lighthouse-core/audits/mainthread-work-breakdown.js +++ b/lighthouse-core/audits/mainthread-work-breakdown.js @@ -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. */ diff --git a/lighthouse-core/audits/metrics.js b/lighthouse-core/audits/metrics.js index 8b207069f507..35ab49f60f5b 100644 --- a/lighthouse-core/audits/metrics.js +++ b/lighthouse-core/audits/metrics.js @@ -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 { /** diff --git a/lighthouse-core/audits/metrics/estimated-input-latency.js b/lighthouse-core/audits/metrics/estimated-input-latency.js index 2f344107202f..866420c1aee0 100644 --- a/lighthouse-core/audits/metrics/estimated-input-latency.js +++ b/lighthouse-core/audits/metrics/estimated-input-latency.js @@ -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. */ diff --git a/lighthouse-core/audits/metrics/first-contentful-paint.js b/lighthouse-core/audits/metrics/first-contentful-paint.js index d79c3f793a18..5da25f0d9a50 100644 --- a/lighthouse-core/audits/metrics/first-contentful-paint.js +++ b/lighthouse-core/audits/metrics/first-contentful-paint.js @@ -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. */ diff --git a/lighthouse-core/audits/metrics/first-cpu-idle.js b/lighthouse-core/audits/metrics/first-cpu-idle.js index 8bab53661fc4..fe2e3d5864ea 100644 --- a/lighthouse-core/audits/metrics/first-cpu-idle.js +++ b/lighthouse-core/audits/metrics/first-cpu-idle.js @@ -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. */ diff --git a/lighthouse-core/audits/metrics/first-meaningful-paint.js b/lighthouse-core/audits/metrics/first-meaningful-paint.js index dd5ef1365c4c..6272884ae299 100644 --- a/lighthouse-core/audits/metrics/first-meaningful-paint.js +++ b/lighthouse-core/audits/metrics/first-meaningful-paint.js @@ -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. */ diff --git a/lighthouse-core/audits/metrics/interactive.js b/lighthouse-core/audits/metrics/interactive.js index fb8f966a1e6a..cd5ab197746e 100644 --- a/lighthouse-core/audits/metrics/interactive.js +++ b/lighthouse-core/audits/metrics/interactive.js @@ -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. */ diff --git a/lighthouse-core/audits/metrics/speed-index.js b/lighthouse-core/audits/metrics/speed-index.js index abfbdf89d3af..54ad2de7b08b 100644 --- a/lighthouse-core/audits/metrics/speed-index.js +++ b/lighthouse-core/audits/metrics/speed-index.js @@ -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. */ diff --git a/lighthouse-core/audits/mixed-content.js b/lighthouse-core/audits/mixed-content.js index b1e238d61a80..f495f204a5e7 100644 --- a/lighthouse-core/audits/mixed-content.js +++ b/lighthouse-core/audits/mixed-content.js @@ -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 diff --git a/lighthouse-core/audits/network-requests.js b/lighthouse-core/audits/network-requests.js index 19e98823f12f..6fb5aa3c2f57 100644 --- a/lighthouse-core/audits/network-requests.js +++ b/lighthouse-core/audits/network-requests.js @@ -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 { /** diff --git a/lighthouse-core/audits/predictive-perf.js b/lighthouse-core/audits/predictive-perf.js index e1fef48c69d0..313b1432b463 100644 --- a/lighthouse-core/audits/predictive-perf.js +++ b/lighthouse-core/audits/predictive-perf.js @@ -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 diff --git a/lighthouse-core/audits/redirects.js b/lighthouse-core/audits/redirects.js index 8d33ceb5c714..fd1a4bcd18f0 100644 --- a/lighthouse-core/audits/redirects.js +++ b/lighthouse-core/audits/redirects.js @@ -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. */ diff --git a/lighthouse-core/audits/screenshot-thumbnails.js b/lighthouse-core/audits/screenshot-thumbnails.js index 068f39ae60a5..1e65c3555ac8 100644 --- a/lighthouse-core/audits/screenshot-thumbnails.js +++ b/lighthouse-core/audits/screenshot-thumbnails.js @@ -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; diff --git a/lighthouse-core/audits/seo/canonical.js b/lighthouse-core/audits/seo/canonical.js index 176676980146..b0032aed2a65 100644 --- a/lighthouse-core/audits/seo/canonical.js +++ b/lighthouse-core/audits/seo/canonical.js @@ -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'; /** diff --git a/lighthouse-core/audits/seo/hreflang.js b/lighthouse-core/audits/seo/hreflang.js index a38ffb407b44..2c1784171391 100644 --- a/lighthouse-core/audits/seo/hreflang.js +++ b/lighthouse-core/audits/seo/hreflang.js @@ -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'; diff --git a/lighthouse-core/audits/seo/http-status-code.js b/lighthouse-core/audits/seo/http-status-code.js index 2665767c5f05..cf80dc5252ab 100644 --- a/lighthouse-core/audits/seo/http-status-code.js +++ b/lighthouse-core/audits/seo/http-status-code.js @@ -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; diff --git a/lighthouse-core/audits/seo/is-crawlable.js b/lighthouse-core/audits/seo/is-crawlable.js index d12d26a52ff4..2230f5a04c12 100644 --- a/lighthouse-core/audits/seo/is-crawlable.js +++ b/lighthouse-core/audits/seo/is-crawlable.js @@ -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', diff --git a/lighthouse-core/audits/splash-screen.js b/lighthouse-core/audits/splash-screen.js index a848cdaac29d..92aaae63dca9 100644 --- a/lighthouse-core/audits/splash-screen.js +++ b/lighthouse-core/audits/splash-screen.js @@ -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 diff --git a/lighthouse-core/audits/themed-omnibox.js b/lighthouse-core/audits/themed-omnibox.js index ba5665bfc67e..25cfda040a0b 100644 --- a/lighthouse-core/audits/themed-omnibox.js +++ b/lighthouse-core/audits/themed-omnibox.js @@ -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'); /** diff --git a/lighthouse-core/audits/time-to-first-byte.js b/lighthouse-core/audits/time-to-first-byte.js index a17cd45fb13f..928e17dd916a 100644 --- a/lighthouse-core/audits/time-to-first-byte.js +++ b/lighthouse-core/audits/time-to-first-byte.js @@ -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. */ diff --git a/lighthouse-core/audits/user-timings.js b/lighthouse-core/audits/user-timings.js index 3cc65e4e416f..366a849f7709 100644 --- a/lighthouse-core/audits/user-timings.js +++ b/lighthouse-core/audits/user-timings.js @@ -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'. */ diff --git a/lighthouse-core/audits/uses-rel-preconnect.js b/lighthouse-core/audits/uses-rel-preconnect.js index 6cbb3aab8b07..f17d1ba58819 100644 --- a/lighthouse-core/audits/uses-rel-preconnect.js +++ b/lighthouse-core/audits/uses-rel-preconnect.js @@ -9,9 +9,9 @@ const Audit = require('./audit'); const UnusedBytes = require('./byte-efficiency/byte-efficiency-audit'); const i18n = require('../lib/i18n/i18n.js'); -const NetworkRecords = require('../gather/computed/network-records.js'); -const MainResource = require('../gather/computed/main-resource.js'); -const LoadSimulator = require('../gather/computed/load-simulator.js'); +const NetworkRecords = require('../computed/network-records.js'); +const MainResource = require('../computed/main-resource.js'); +const LoadSimulator = require('../computed/load-simulator.js'); // Preconnect establishes a "clean" socket. Chrome's socket manager will keep an unused socket // around for 10s. Meaning, the time delta between processing preconnect a request should be <10s, diff --git a/lighthouse-core/audits/uses-rel-preload.js b/lighthouse-core/audits/uses-rel-preload.js index 7f0e9f04e63b..bcaf39191ad9 100644 --- a/lighthouse-core/audits/uses-rel-preload.js +++ b/lighthouse-core/audits/uses-rel-preload.js @@ -8,11 +8,11 @@ const URL = require('../lib/url-shim'); const Audit = require('./audit'); const UnusedBytes = require('./byte-efficiency/byte-efficiency-audit'); -const CriticalRequestChains = require('../gather/computed/critical-request-chains'); +const CriticalRequestChains = require('../computed/critical-request-chains.js'); const i18n = require('../lib/i18n/i18n.js'); -const MainResource = require('../gather/computed/main-resource.js'); -const PageDependencyGraph = require('../gather/computed/page-dependency-graph.js'); -const LoadSimulator = require('../gather/computed/load-simulator.js'); +const MainResource = require('../computed/main-resource.js'); +const PageDependencyGraph = require('../computed/page-dependency-graph.js'); +const LoadSimulator = require('../computed/load-simulator.js'); const UIStrings = { /** Imperative title of a Lighthouse audit that tells the user to use to initiate important network requests earlier during page load. This is displayed in a list of audit titles that Lighthouse generates. */ diff --git a/lighthouse-core/audits/webapp-install-banner.js b/lighthouse-core/audits/webapp-install-banner.js index e9020a368a75..d0cbc2b0fae9 100644 --- a/lighthouse-core/audits/webapp-install-banner.js +++ b/lighthouse-core/audits/webapp-install-banner.js @@ -7,7 +7,7 @@ const MultiCheckAudit = require('./multi-check-audit'); const SWAudit = require('./service-worker'); -const ManifestValues = require('../gather/computed/manifest-values'); +const ManifestValues = require('../computed/manifest-values.js'); /** * @fileoverview diff --git a/lighthouse-core/gather/computed/new-computed-artifact.js b/lighthouse-core/computed/computed-artifact.js similarity index 96% rename from lighthouse-core/gather/computed/new-computed-artifact.js rename to lighthouse-core/computed/computed-artifact.js index 2c41be19811a..471a027e4214 100644 --- a/lighthouse-core/gather/computed/new-computed-artifact.js +++ b/lighthouse-core/computed/computed-artifact.js @@ -5,7 +5,7 @@ */ 'use strict'; -const ArbitraryEqualityMap = require('../../lib/arbitrary-equality-map.js'); +const ArbitraryEqualityMap = require('../lib/arbitrary-equality-map.js'); /** * Decorate computableArtifact with a caching `request()` method which will diff --git a/lighthouse-core/gather/computed/critical-request-chains.js b/lighthouse-core/computed/critical-request-chains.js similarity index 97% rename from lighthouse-core/gather/computed/critical-request-chains.js rename to lighthouse-core/computed/critical-request-chains.js index 560ad729cb79..e920796242c1 100644 --- a/lighthouse-core/gather/computed/critical-request-chains.js +++ b/lighthouse-core/computed/critical-request-chains.js @@ -5,8 +5,8 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact.js'); -const NetworkRequest = require('../../lib/network-request'); +const makeComputedArtifact = require('./computed-artifact.js'); +const NetworkRequest = require('../lib/network-request.js'); const assert = require('assert'); const NetworkRecords = require('./network-records.js'); const MainResource = require('./main-resource.js'); diff --git a/lighthouse-core/gather/computed/load-simulator.js b/lighthouse-core/computed/load-simulator.js similarity index 89% rename from lighthouse-core/gather/computed/load-simulator.js rename to lighthouse-core/computed/load-simulator.js index 555b168be0b1..5ac526ec5a4a 100644 --- a/lighthouse-core/gather/computed/load-simulator.js +++ b/lighthouse-core/computed/load-simulator.js @@ -5,10 +5,10 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact'); -const constants = require('../../config/constants'); -const Simulator = require('../../lib/dependency-graph/simulator/simulator'); -const NetworkAnalysis = require('../../gather/computed/network-analysis.js'); +const makeComputedArtifact = require('./computed-artifact.js'); +const constants = require('../config/constants.js'); +const Simulator = require('../lib/dependency-graph/simulator/simulator.js'); +const NetworkAnalysis = require('./network-analysis.js'); class LoadSimulator { /** diff --git a/lighthouse-core/gather/computed/main-resource.js b/lighthouse-core/computed/main-resource.js similarity index 93% rename from lighthouse-core/gather/computed/main-resource.js rename to lighthouse-core/computed/main-resource.js index 7f6b6e19899a..0dfc0bd4746d 100644 --- a/lighthouse-core/gather/computed/main-resource.js +++ b/lighthouse-core/computed/main-resource.js @@ -5,8 +5,8 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact.js'); -const URL = require('../../lib/url-shim'); +const makeComputedArtifact = require('./computed-artifact.js'); +const URL = require('../lib/url-shim.js'); const NetworkRecords = require('./network-records.js'); /** diff --git a/lighthouse-core/gather/computed/main-thread-tasks.js b/lighthouse-core/computed/main-thread-tasks.js similarity index 97% rename from lighthouse-core/gather/computed/main-thread-tasks.js rename to lighthouse-core/computed/main-thread-tasks.js index 54ba7f3a8135..5b18eb33b1c5 100644 --- a/lighthouse-core/gather/computed/main-thread-tasks.js +++ b/lighthouse-core/computed/main-thread-tasks.js @@ -5,8 +5,8 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact.js'); -const {taskGroups, taskNameToGroup} = require('../../lib/task-groups'); +const makeComputedArtifact = require('./computed-artifact.js'); +const {taskGroups, taskNameToGroup} = require('../lib/task-groups.js'); const TraceOfTab = require('./trace-of-tab.js'); /** @@ -26,7 +26,7 @@ const TraceOfTab = require('./trace-of-tab.js'); * attributableURL for the script that was executing/forced this execution. */ -/** @typedef {import('../../lib/task-groups.js').TaskGroup} TaskGroup */ +/** @typedef {import('../lib/task-groups.js').TaskGroup} TaskGroup */ /** * @typedef TaskNode diff --git a/lighthouse-core/gather/computed/manifest-values.js b/lighthouse-core/computed/manifest-values.js similarity index 97% rename from lighthouse-core/gather/computed/manifest-values.js rename to lighthouse-core/computed/manifest-values.js index a73c28f9f089..113cb46af63e 100644 --- a/lighthouse-core/gather/computed/manifest-values.js +++ b/lighthouse-core/computed/manifest-values.js @@ -5,8 +5,8 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact'); -const icons = require('../../lib/icons'); +const makeComputedArtifact = require('./computed-artifact.js'); +const icons = require('../lib/icons.js'); const PWA_DISPLAY_VALUES = ['minimal-ui', 'fullscreen', 'standalone']; diff --git a/lighthouse-core/gather/computed/metrics/estimated-input-latency.js b/lighthouse-core/computed/metrics/estimated-input-latency.js similarity index 91% rename from lighthouse-core/gather/computed/metrics/estimated-input-latency.js rename to lighthouse-core/computed/metrics/estimated-input-latency.js index cc4725577633..66ddd8a82d8a 100644 --- a/lighthouse-core/gather/computed/metrics/estimated-input-latency.js +++ b/lighthouse-core/computed/metrics/estimated-input-latency.js @@ -5,10 +5,10 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const ComputedMetric = require('./metric'); -const LHError = require('../../../lib/lh-error'); -const TracingProcessor = require('../../../lib/traces/tracing-processor'); +const makeComputedArtifact = require('../computed-artifact.js'); +const ComputedMetric = require('./metric.js'); +const LHError = require('../../lib/lh-error.js'); +const TracingProcessor = require('../../lib/traces/tracing-processor.js'); const LanternEstimatedInputLatency = require('./lantern-estimated-input-latency.js'); const ROLLING_WINDOW_SIZE = 5000; diff --git a/lighthouse-core/gather/computed/metrics/first-contentful-paint.js b/lighthouse-core/computed/metrics/first-contentful-paint.js similarity index 92% rename from lighthouse-core/gather/computed/metrics/first-contentful-paint.js rename to lighthouse-core/computed/metrics/first-contentful-paint.js index 1cd50d2b3599..c5c6db5ab572 100644 --- a/lighthouse-core/gather/computed/metrics/first-contentful-paint.js +++ b/lighthouse-core/computed/metrics/first-contentful-paint.js @@ -5,8 +5,8 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const ComputedMetric = require('./metric'); +const makeComputedArtifact = require('../computed-artifact.js'); +const ComputedMetric = require('./metric.js'); const LanternFirstContentfulPaint = require('./lantern-first-contentful-paint.js'); class FirstContentfulPaint extends ComputedMetric { diff --git a/lighthouse-core/gather/computed/metrics/first-cpu-idle.js b/lighthouse-core/computed/metrics/first-cpu-idle.js similarity index 97% rename from lighthouse-core/gather/computed/metrics/first-cpu-idle.js rename to lighthouse-core/computed/metrics/first-cpu-idle.js index 013fd865bc23..450dbe103ea9 100644 --- a/lighthouse-core/gather/computed/metrics/first-cpu-idle.js +++ b/lighthouse-core/computed/metrics/first-cpu-idle.js @@ -5,10 +5,10 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const ComputedMetric = require('./metric'); -const TracingProcessor = require('../../../lib/traces/tracing-processor'); -const LHError = require('../../../lib/lh-error'); +const makeComputedArtifact = require('../computed-artifact.js'); +const ComputedMetric = require('./metric.js'); +const TracingProcessor = require('../../lib/traces/tracing-processor.js'); +const LHError = require('../../lib/lh-error.js'); const LanternFirstCPUIdle = require('./lantern-first-cpu-idle.js'); const LONG_TASK_THRESHOLD = 50; diff --git a/lighthouse-core/gather/computed/metrics/first-meaningful-paint.js b/lighthouse-core/computed/metrics/first-meaningful-paint.js similarity index 90% rename from lighthouse-core/gather/computed/metrics/first-meaningful-paint.js rename to lighthouse-core/computed/metrics/first-meaningful-paint.js index 6dce5fd0c000..f43a6bad0be8 100644 --- a/lighthouse-core/gather/computed/metrics/first-meaningful-paint.js +++ b/lighthouse-core/computed/metrics/first-meaningful-paint.js @@ -5,9 +5,9 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const ComputedMetric = require('./metric'); -const LHError = require('../../../lib/lh-error'); +const makeComputedArtifact = require('../computed-artifact.js'); +const ComputedMetric = require('./metric.js'); +const LHError = require('../../lib/lh-error.js'); const LanternFirstMeaningfulPaint = require('./lantern-first-meaningful-paint.js'); class FirstMeaningfulPaint extends ComputedMetric { diff --git a/lighthouse-core/gather/computed/metrics/interactive.js b/lighthouse-core/computed/metrics/interactive.js similarity index 96% rename from lighthouse-core/gather/computed/metrics/interactive.js rename to lighthouse-core/computed/metrics/interactive.js index 5c43d5c75b73..31ad39ae998b 100644 --- a/lighthouse-core/gather/computed/metrics/interactive.js +++ b/lighthouse-core/computed/metrics/interactive.js @@ -5,13 +5,13 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); +const makeComputedArtifact = require('../computed-artifact.js'); const ComputedMetric = require('./metric.js'); const LanternInteractive = require('./lantern-interactive.js'); -const NetworkRecorder = require('../../../lib/network-recorder'); -const TracingProcessor = require('../../../lib/traces/tracing-processor'); -const LHError = require('../../../lib/lh-error'); +const NetworkRecorder = require('../../lib/network-recorder.js'); +const TracingProcessor = require('../../lib/traces/tracing-processor.js'); +const LHError = require('../../lib/lh-error.js'); const REQUIRED_QUIET_WINDOW = 5000; const ALLOWED_CONCURRENT_REQUESTS = 2; diff --git a/lighthouse-core/gather/computed/metrics/lantern-estimated-input-latency.js b/lighthouse-core/computed/metrics/lantern-estimated-input-latency.js similarity index 94% rename from lighthouse-core/gather/computed/metrics/lantern-estimated-input-latency.js rename to lighthouse-core/computed/metrics/lantern-estimated-input-latency.js index c11e8119de78..73dcbacbd08c 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-estimated-input-latency.js +++ b/lighthouse-core/computed/metrics/lantern-estimated-input-latency.js @@ -5,9 +5,9 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const LanternMetric = require('./lantern-metric'); -const BaseNode = require('../../../lib/dependency-graph/base-node'); +const makeComputedArtifact = require('../computed-artifact.js'); +const LanternMetric = require('./lantern-metric.js'); +const BaseNode = require('../../lib/dependency-graph/base-node.js'); const LanternFirstMeaningfulPaint = require('./lantern-first-meaningful-paint.js'); /** @typedef {BaseNode.Node} Node */ @@ -58,7 +58,7 @@ class LanternEstimatedInputLatency extends LanternMetric { ); // Require here to resolve circular dependency. - const EstimatedInputLatency = require('./estimated-input-latency'); + const EstimatedInputLatency = require('./estimated-input-latency.js'); return { timeInMs: EstimatedInputLatency.calculateRollingWindowEIL(events), diff --git a/lighthouse-core/gather/computed/metrics/lantern-first-contentful-paint.js b/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js similarity index 93% rename from lighthouse-core/gather/computed/metrics/lantern-first-contentful-paint.js rename to lighthouse-core/computed/metrics/lantern-first-contentful-paint.js index 2e48e4337fd1..807aaf506151 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-first-contentful-paint.js +++ b/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js @@ -5,9 +5,9 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const LanternMetric = require('./lantern-metric'); -const BaseNode = require('../../../lib/dependency-graph/base-node'); +const makeComputedArtifact = require('../computed-artifact.js'); +const LanternMetric = require('./lantern-metric.js'); +const BaseNode = require('../../lib/dependency-graph/base-node.js'); /** @typedef {BaseNode.Node} Node */ diff --git a/lighthouse-core/gather/computed/metrics/lantern-first-cpu-idle.js b/lighthouse-core/computed/metrics/lantern-first-cpu-idle.js similarity index 92% rename from lighthouse-core/gather/computed/metrics/lantern-first-cpu-idle.js rename to lighthouse-core/computed/metrics/lantern-first-cpu-idle.js index d624de7eab89..cc571befd365 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-first-cpu-idle.js +++ b/lighthouse-core/computed/metrics/lantern-first-cpu-idle.js @@ -5,9 +5,9 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const BaseNode = require('../../../lib/dependency-graph/base-node'); -const LanternInteractive = require('./lantern-interactive'); +const makeComputedArtifact = require('../computed-artifact.js'); +const BaseNode = require('../../lib/dependency-graph/base-node.js'); +const LanternInteractive = require('./lantern-interactive.js'); class LanternFirstCPUIdle extends LanternInteractive { /** diff --git a/lighthouse-core/gather/computed/metrics/lantern-first-meaningful-paint.js b/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js similarity index 95% rename from lighthouse-core/gather/computed/metrics/lantern-first-meaningful-paint.js rename to lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js index 42b15f38b150..eef535031fef 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-first-meaningful-paint.js +++ b/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js @@ -5,10 +5,10 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); +const makeComputedArtifact = require('../computed-artifact.js'); const LanternMetric = require('./lantern-metric.js'); -const BaseNode = require('../../../lib/dependency-graph/base-node'); -const LHError = require('../../../lib/lh-error'); +const BaseNode = require('../../lib/dependency-graph/base-node.js'); +const LHError = require('../../lib/lh-error.js'); const LanternFirstContentfulPaint = require('./lantern-first-contentful-paint.js'); /** @typedef {BaseNode.Node} Node */ diff --git a/lighthouse-core/gather/computed/metrics/lantern-interactive.js b/lighthouse-core/computed/metrics/lantern-interactive.js similarity index 95% rename from lighthouse-core/gather/computed/metrics/lantern-interactive.js rename to lighthouse-core/computed/metrics/lantern-interactive.js index 18259c84269f..adcb7f99e7c1 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-interactive.js +++ b/lighthouse-core/computed/metrics/lantern-interactive.js @@ -5,10 +5,10 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); +const makeComputedArtifact = require('../computed-artifact.js'); const LanternMetric = require('./lantern-metric.js'); -const BaseNode = require('../../../lib/dependency-graph/base-node'); -const NetworkRequest = require('../../../lib/network-request'); +const BaseNode = require('../../lib/dependency-graph/base-node.js'); +const NetworkRequest = require('../../lib/network-request.js'); const LanternFirstMeaningfulPaint = require('./lantern-first-meaningful-paint.js'); /** @typedef {BaseNode.Node} Node */ diff --git a/lighthouse-core/gather/computed/metrics/lantern-metric.js b/lighthouse-core/computed/metrics/lantern-metric.js similarity index 94% rename from lighthouse-core/gather/computed/metrics/lantern-metric.js rename to lighthouse-core/computed/metrics/lantern-metric.js index d75e2205b392..9362d589b7ff 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-metric.js +++ b/lighthouse-core/computed/metrics/lantern-metric.js @@ -5,15 +5,15 @@ */ 'use strict'; -const BaseNode = require('../../../lib/dependency-graph/base-node'); -const NetworkRequest = require('../../../lib/network-request'); +const BaseNode = require('../../lib/dependency-graph/base-node.js'); +const NetworkRequest = require('../../lib/network-request.js'); const TraceOfTab = require('../trace-of-tab.js'); const PageDependencyGraph = require('../page-dependency-graph.js'); const LoadSimulator = require('../load-simulator.js'); /** @typedef {BaseNode.Node} Node */ -/** @typedef {import('../../../lib/dependency-graph/network-node')} NetworkNode */ -/** @typedef {import('../../../lib/dependency-graph/simulator/simulator')} Simulator */ +/** @typedef {import('../../lib/dependency-graph/network-node')} NetworkNode */ +/** @typedef {import('../../lib/dependency-graph/simulator/simulator')} Simulator */ class LanternMetricArtifact { /** diff --git a/lighthouse-core/gather/computed/metrics/lantern-speed-index.js b/lighthouse-core/computed/metrics/lantern-speed-index.js similarity index 95% rename from lighthouse-core/gather/computed/metrics/lantern-speed-index.js rename to lighthouse-core/computed/metrics/lantern-speed-index.js index 2314913e4649..7b6c5d53dafa 100644 --- a/lighthouse-core/gather/computed/metrics/lantern-speed-index.js +++ b/lighthouse-core/computed/metrics/lantern-speed-index.js @@ -5,9 +5,9 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const LanternMetric = require('./lantern-metric'); -const BaseNode = require('../../../lib/dependency-graph/base-node'); +const makeComputedArtifact = require('../computed-artifact.js'); +const LanternMetric = require('./lantern-metric.js'); +const BaseNode = require('../../lib/dependency-graph/base-node.js'); const Speedline = require('../speedline.js'); const LanternFirstContentfulPaint = require('./lantern-first-contentful-paint.js'); diff --git a/lighthouse-core/gather/computed/metrics/metric.js b/lighthouse-core/computed/metrics/metric.js similarity index 97% rename from lighthouse-core/gather/computed/metrics/metric.js rename to lighthouse-core/computed/metrics/metric.js index 84bf93819550..6dd4c3102725 100644 --- a/lighthouse-core/gather/computed/metrics/metric.js +++ b/lighthouse-core/computed/metrics/metric.js @@ -5,7 +5,7 @@ */ 'use strict'; -const TracingProcessor = require('../../../lib/traces/tracing-processor'); +const TracingProcessor = require('../../lib/traces/tracing-processor.js'); const TraceOfTab = require('../trace-of-tab.js'); const NetworkRecords = require('../network-records.js'); diff --git a/lighthouse-core/gather/computed/metrics/speed-index.js b/lighthouse-core/computed/metrics/speed-index.js similarity index 93% rename from lighthouse-core/gather/computed/metrics/speed-index.js rename to lighthouse-core/computed/metrics/speed-index.js index 9f60e3886288..fd27fe685fb0 100644 --- a/lighthouse-core/gather/computed/metrics/speed-index.js +++ b/lighthouse-core/computed/metrics/speed-index.js @@ -5,8 +5,8 @@ */ 'use strict'; -const makeComputedArtifact = require('../new-computed-artifact.js'); -const ComputedMetric = require('./metric'); +const makeComputedArtifact = require('../computed-artifact.js'); +const ComputedMetric = require('./metric.js'); const LanternSpeedIndex = require('./lantern-speed-index.js'); const Speedline = require('../speedline.js'); diff --git a/lighthouse-core/gather/computed/network-analysis.js b/lighthouse-core/computed/network-analysis.js similarity index 94% rename from lighthouse-core/gather/computed/network-analysis.js rename to lighthouse-core/computed/network-analysis.js index a0e6e4adeefd..267afe235713 100644 --- a/lighthouse-core/gather/computed/network-analysis.js +++ b/lighthouse-core/computed/network-analysis.js @@ -5,8 +5,8 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact.js'); -const NetworkAnalyzer = require('../../lib/dependency-graph/simulator/network-analyzer'); +const makeComputedArtifact = require('./computed-artifact.js'); +const NetworkAnalyzer = require('../lib/dependency-graph/simulator/network-analyzer.js'); const NetworkRecords = require('./network-records.js'); class NetworkAnalysis { diff --git a/lighthouse-core/gather/computed/network-records.js b/lighthouse-core/computed/network-records.js similarity index 87% rename from lighthouse-core/gather/computed/network-records.js rename to lighthouse-core/computed/network-records.js index a2e9f7cb0870..8e3586841bc6 100644 --- a/lighthouse-core/gather/computed/network-records.js +++ b/lighthouse-core/computed/network-records.js @@ -5,8 +5,8 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact.js'); -const NetworkRecorder = require('../../lib/network-recorder'); +const makeComputedArtifact = require('./computed-artifact.js'); +const NetworkRecorder = require('../lib/network-recorder.js'); class NetworkRecords { /** diff --git a/lighthouse-core/gather/computed/page-dependency-graph.js b/lighthouse-core/computed/page-dependency-graph.js similarity index 96% rename from lighthouse-core/gather/computed/page-dependency-graph.js rename to lighthouse-core/computed/page-dependency-graph.js index 4b6deeadc909..44e1fdf42eda 100644 --- a/lighthouse-core/gather/computed/page-dependency-graph.js +++ b/lighthouse-core/computed/page-dependency-graph.js @@ -5,16 +5,16 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact'); -const NetworkNode = require('../../lib/dependency-graph/network-node'); -const CPUNode = require('../../lib/dependency-graph/cpu-node'); -const NetworkAnalyzer = require('../../lib/dependency-graph/simulator/network-analyzer'); -const TracingProcessor = require('../../lib/traces/tracing-processor'); -const NetworkRequest = require('../../lib/network-request'); +const makeComputedArtifact = require('./computed-artifact.js'); +const NetworkNode = require('../lib/dependency-graph/network-node.js'); +const CPUNode = require('../lib/dependency-graph/cpu-node.js'); +const NetworkAnalyzer = require('../lib/dependency-graph/simulator/network-analyzer.js'); +const TracingProcessor = require('../lib/traces/tracing-processor.js'); +const NetworkRequest = require('../lib/network-request.js'); const TraceOfTab = require('./trace-of-tab.js'); const NetworkRecords = require('./network-records.js'); -/** @typedef {import('../../lib/dependency-graph/base-node.js').Node} Node */ +/** @typedef {import('../lib/dependency-graph/base-node.js').Node} Node */ // Tasks smaller than 10 ms have minimal impact on simulation const MINIMUM_TASK_DURATION_OF_INTEREST = 10; diff --git a/lighthouse-core/gather/computed/pushed-requests.js b/lighthouse-core/computed/pushed-requests.js similarity index 94% rename from lighthouse-core/gather/computed/pushed-requests.js rename to lighthouse-core/computed/pushed-requests.js index 0cba6f6ed336..03bb4e1457bc 100644 --- a/lighthouse-core/gather/computed/pushed-requests.js +++ b/lighthouse-core/computed/pushed-requests.js @@ -5,7 +5,7 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact.js'); +const makeComputedArtifact = require('./computed-artifact.js'); const NetworkRecords = require('./network-records.js'); class PushedRequests { diff --git a/lighthouse-core/gather/computed/screenshots.js b/lighthouse-core/computed/screenshots.js similarity index 94% rename from lighthouse-core/gather/computed/screenshots.js rename to lighthouse-core/computed/screenshots.js index 3e0cc4dde41c..7f10e080490e 100644 --- a/lighthouse-core/gather/computed/screenshots.js +++ b/lighthouse-core/computed/screenshots.js @@ -5,7 +5,7 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact'); +const makeComputedArtifact = require('./computed-artifact.js'); const SCREENSHOT_TRACE_NAME = 'Screenshot'; diff --git a/lighthouse-core/gather/computed/speedline.js b/lighthouse-core/computed/speedline.js similarity index 94% rename from lighthouse-core/gather/computed/speedline.js rename to lighthouse-core/computed/speedline.js index bcd083ccb16e..8bc69448859f 100644 --- a/lighthouse-core/gather/computed/speedline.js +++ b/lighthouse-core/computed/speedline.js @@ -5,9 +5,9 @@ */ 'use strict'; -const makeComputedArtifact = require('./new-computed-artifact.js'); +const makeComputedArtifact = require('./computed-artifact.js'); const speedline = require('speedline-core'); -const LHError = require('../../lib/lh-error'); +const LHError = require('../lib/lh-error.js'); const TraceOfTab = require('./trace-of-tab.js'); class Speedline { diff --git a/lighthouse-core/gather/computed/trace-of-tab.js b/lighthouse-core/computed/trace-of-tab.js similarity index 97% rename from lighthouse-core/gather/computed/trace-of-tab.js rename to lighthouse-core/computed/trace-of-tab.js index f1c7ab92d321..284c6d9e6055 100644 --- a/lighthouse-core/gather/computed/trace-of-tab.js +++ b/lighthouse-core/computed/trace-of-tab.js @@ -16,11 +16,11 @@ * 4. Return all those items in one handy bundle. */ -const makeComputedArtifact = require('./new-computed-artifact.js'); +const makeComputedArtifact = require('./computed-artifact.js'); const log = require('lighthouse-logger'); -const TracingProcessor = require('../../lib/traces/tracing-processor'); -const LHError = require('../../lib/lh-error'); -const Sentry = require('../../lib/sentry'); +const TracingProcessor = require('../lib/traces/tracing-processor.js'); +const LHError = require('../lib/lh-error.js'); +const Sentry = require('../lib/sentry.js'); const ACCEPTABLE_NAVIGATION_URL_REGEX = /^(chrome|https?):/; diff --git a/lighthouse-core/gather/computed/computed-artifact.js b/lighthouse-core/gather/computed/computed-artifact.js deleted file mode 100644 index 7556bd9fb889..000000000000 --- a/lighthouse-core/gather/computed/computed-artifact.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @license Copyright 2016 Google Inc. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ -'use strict'; - -const ArbitraryEqualityMap = require('../../lib/arbitrary-equality-map'); -const log = require('lighthouse-logger'); - -class ComputedArtifact { - /** - * @param {*} allComputedArtifacts - */ - constructor(allComputedArtifacts) { - const cache = new ArbitraryEqualityMap(); - cache.setEqualityFn(ArbitraryEqualityMap.deepEquals); - - /** @type {Map, Promise>>} */ - // @ts-ignore cache is close enough to a Map for our purposes (but e.g. no [Symbol.toStringTag]) - this._cache = cache; - - /** @type {*} */ - this._allComputedArtifacts = allComputedArtifacts; - } - - /** - * @return {string} - */ - get name() { - throw new Error('name getter not implemented for computed artifact ' + this.constructor.name); - } - - /* eslint-disable no-unused-vars */ - - /** - * Override with more specific `artifact` and return type to implement a - * computed artifact. - * @param {*} artifact Input to computation. - * @param {*} allComputedArtifacts Access to all computed artifacts. - * @return {Promise<*>} - * @throws {Error} - */ - async compute_(artifact, allComputedArtifacts) { - throw new Error('compute_() not implemented for computed artifact ' + this.name); - } - - /* eslint-enable no-unused-vars */ - - /** - * Request a computed artifact, caching the result on the input artifact. - * Types of `requiredArtifacts` and the return value are derived from the - * `compute_` method on classes derived from ComputedArtifact. - * @param {FirstParamType} requiredArtifacts - * @return {Promise>} - */ - async request(requiredArtifacts) { - const computed = this._cache.get(requiredArtifacts); - if (computed) { - return computed; - } - - const status = {msg: `Computing artifact: ${this.name}`, id: `lh:computed:${this.name}`}; - log.time(status, 'verbose'); - // Need to cast since `this.compute_(...)` returns the concrete return type - // of the base class's compute_, not the called derived class's. - const artifactPromise = /** @type {ReturnType} */ ( - this.compute_(requiredArtifacts, this._allComputedArtifacts)); - this._cache.set(requiredArtifacts, artifactPromise); - - artifactPromise.then(() => log.timeEnd(status)); - return artifactPromise; - } -} - -module.exports = ComputedArtifact; diff --git a/lighthouse-core/scripts/lantern/minify-trace.js b/lighthouse-core/scripts/lantern/minify-trace.js index d5aede803ac7..c41f5d3c9f51 100755 --- a/lighthouse-core/scripts/lantern/minify-trace.js +++ b/lighthouse-core/scripts/lantern/minify-trace.js @@ -11,8 +11,8 @@ /** * @fileoverview Minifies a trace by removing unnecessary events, throttling screenshots, etc. * See the following files for necessary events: - * - lighthouse-core/gather/computed/trace-of-tab.js - * - lighthouse-core/gather/computed/page-dependency-graph.js + * - lighthouse-core/computed/trace-of-tab.js + * - lighthouse-core/computed/page-dependency-graph.js * - lighthouse-core/lib/traces/tracing-processor.js */ diff --git a/lighthouse-core/test/audits/byte-efficiency/byte-efficiency-audit-test.js b/lighthouse-core/test/audits/byte-efficiency/byte-efficiency-audit-test.js index 19ea0d66e020..135c661fb613 100644 --- a/lighthouse-core/test/audits/byte-efficiency/byte-efficiency-audit-test.js +++ b/lighthouse-core/test/audits/byte-efficiency/byte-efficiency-audit-test.js @@ -9,8 +9,8 @@ const ByteEfficiencyAudit_ = require('../../../audits/byte-efficiency/byte-effic const NetworkNode = require('../../../lib/dependency-graph/network-node'); const CPUNode = require('../../../lib/dependency-graph/cpu-node'); const Simulator = require('../../../lib/dependency-graph/simulator/simulator'); -const PageDependencyGraph = require('../../../gather/computed/page-dependency-graph.js'); -const LoadSimulator = require('../../../gather/computed/load-simulator.js'); +const PageDependencyGraph = require('../../../computed/page-dependency-graph.js'); +const LoadSimulator = require('../../../computed/load-simulator.js'); const trace = require('../../fixtures/traces/progressive-app-m60.json'); diff --git a/lighthouse-core/test/gather/computed/computed-artifact-test.js b/lighthouse-core/test/computed/computed-artifact-test.js similarity index 51% rename from lighthouse-core/test/gather/computed/computed-artifact-test.js rename to lighthouse-core/test/computed/computed-artifact-test.js index a6b535adf778..2c7d3a866f88 100644 --- a/lighthouse-core/test/gather/computed/computed-artifact-test.js +++ b/lighthouse-core/test/computed/computed-artifact-test.js @@ -9,41 +9,33 @@ const assert = require('assert'); -const ComputedArtifact = require('../../../gather/computed/computed-artifact'); +const makeComputedArtifact = require('../../computed/computed-artifact.js'); -class TestComputedArtifact extends ComputedArtifact { - constructor(...args) { - super(...args); - - this.lastArguments = []; - this.computeCounter = 0; - } - - get name() { - return 'TestComputedArtifact'; - } +describe('ComputedArtifact base class', () => { + it.skip('caches computed artifacts by strict equality', async () => { + let computeCounter = 0; - async compute_(...args) { - this.lastArguments = args; - return this.computeCounter++; - } -} + const TestComputedArtifact = makeComputedArtifact(class TestComputedArtifact { + static async compute_() { + return computeCounter++; + } + }); -describe('ComputedArtifact base class', () => { - it('caches computed artifacts by strict equality', async () => { - const computedArtifact = new TestComputedArtifact(); + const context = { + computedCache: new Map(), + }; - let result = await computedArtifact.request({x: 1}); + let result = await TestComputedArtifact.request({x: 1}, context); assert.equal(result, 0); - result = await computedArtifact.request({x: 2}); + result = await TestComputedArtifact.request({x: 2}, context); assert.equal(result, 1); - result = await computedArtifact.request({x: 1}); + result = await TestComputedArtifact.request({x: 1}, context); assert.equal(result, 0); - result = await computedArtifact.request({x: 2}); + result = await TestComputedArtifact.request({x: 2}, context); assert.equal(result, 1); - assert.equal(computedArtifact.computeCounter, 2); + assert.equal(computeCounter, 2); }); }); diff --git a/lighthouse-core/test/gather/computed/critical-request-chains-test.js b/lighthouse-core/test/computed/critical-request-chains-test.js similarity index 96% rename from lighthouse-core/test/gather/computed/critical-request-chains-test.js rename to lighthouse-core/test/computed/critical-request-chains-test.js index b1d5a34ef67d..1d6ec57454b7 100644 --- a/lighthouse-core/test/gather/computed/critical-request-chains-test.js +++ b/lighthouse-core/test/computed/critical-request-chains-test.js @@ -8,10 +8,10 @@ /* eslint-env jest */ const assert = require('assert'); -const CriticalRequestChains = require('../../../gather/computed/critical-request-chains'); -const NetworkRequest = require('../../../lib/network-request'); -const NetworkRecords = require('../../../gather/computed/network-records.js'); -const ComputedCrc = require('../../../gather/computed/critical-request-chains.js'); +const CriticalRequestChains = require('../../computed/critical-request-chains.js'); +const NetworkRequest = require('../../lib/network-request.js'); +const NetworkRecords = require('../../computed/network-records.js'); +const ComputedCrc = require('../../computed/critical-request-chains.js'); const HIGH = 'High'; const VERY_HIGH = 'VeryHigh'; @@ -48,8 +48,8 @@ function replaceChain(chains, networkRecords) { describe('CriticalRequestChain gatherer: extractChain function', () => { it('returns correct data for chain from a devtoolsLog', () => { - const wikiDevtoolsLog = require('../../fixtures/wikipedia-redirect.devtoolslog.json'); - const wikiChains = require('../../fixtures/wikipedia-redirect.critical-request-chains.json'); + const wikiDevtoolsLog = require('../fixtures/wikipedia-redirect.devtoolslog.json'); + const wikiChains = require('../fixtures/wikipedia-redirect.critical-request-chains.json'); const URL = {finalUrl: 'https://en.m.wikipedia.org/wiki/Main_Page'}; const context = {computedCache: new Map()}; diff --git a/lighthouse-core/test/gather/computed/load-simulator-test.js b/lighthouse-core/test/computed/load-simulator-test.js similarity index 93% rename from lighthouse-core/test/gather/computed/load-simulator-test.js rename to lighthouse-core/test/computed/load-simulator-test.js index 8e37a584b95f..09501e8d6b78 100644 --- a/lighthouse-core/test/gather/computed/load-simulator-test.js +++ b/lighthouse-core/test/computed/load-simulator-test.js @@ -8,8 +8,8 @@ /* eslint-env jest */ const assert = require('assert'); -const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); -const LoadSimulator = require('../../../gather/computed/load-simulator.js'); +const devtoolsLog = require('../fixtures/traces/progressive-app-m60.devtools.log.json'); +const LoadSimulator = require('../../computed/load-simulator.js'); describe('Simulator artifact', () => { it('returns a simulator for "provided" throttling', async () => { diff --git a/lighthouse-core/test/gather/computed/main-resource-test.js b/lighthouse-core/test/computed/main-resource-test.js similarity index 91% rename from lighthouse-core/test/gather/computed/main-resource-test.js rename to lighthouse-core/test/computed/main-resource-test.js index 61eea40de070..b2276ad4744a 100644 --- a/lighthouse-core/test/gather/computed/main-resource-test.js +++ b/lighthouse-core/test/computed/main-resource-test.js @@ -7,9 +7,9 @@ /* eslint-env jest */ -const MainResource = require('../../../gather/computed/main-resource.js'); +const MainResource = require('../../computed/main-resource.js'); const assert = require('assert'); -const networkRecordsToDevtoolsLog = require('../../network-records-to-devtools-log.js'); +const networkRecordsToDevtoolsLog = require('../network-records-to-devtools-log.js'); describe('MainResource computed artifact', () => { it('returns an artifact', () => { @@ -45,7 +45,7 @@ describe('MainResource computed artifact', () => { }); it('should identify correct main resource in the wikipedia fixture', () => { - const wikiDevtoolsLog = require('../../fixtures/wikipedia-redirect.devtoolslog.json'); + const wikiDevtoolsLog = require('../fixtures/wikipedia-redirect.devtoolslog.json'); const URL = {finalUrl: 'https://en.m.wikipedia.org/wiki/Main_Page'}; const artifacts = {devtoolsLog: wikiDevtoolsLog, URL}; diff --git a/lighthouse-core/test/gather/computed/main-thread-tasks-test.js b/lighthouse-core/test/computed/main-thread-tasks-test.js similarity index 95% rename from lighthouse-core/test/gather/computed/main-thread-tasks-test.js rename to lighthouse-core/test/computed/main-thread-tasks-test.js index 93ce3aa38578..e3babd95effd 100644 --- a/lighthouse-core/test/gather/computed/main-thread-tasks-test.js +++ b/lighthouse-core/test/computed/main-thread-tasks-test.js @@ -7,10 +7,10 @@ /* eslint-env jest */ -const MainThreadTasks = require('../../../gather/computed/main-thread-tasks.js'); -const taskGroups = require('../../../lib/task-groups.js').taskGroups; -const pwaTrace = require('../../fixtures/traces/progressive-app.json'); -const TracingProcessor = require('../../../lib/traces/tracing-processor.js'); +const MainThreadTasks = require('../../computed/main-thread-tasks.js'); +const taskGroups = require('../../lib/task-groups.js').taskGroups; +const pwaTrace = require('../fixtures/traces/progressive-app.json'); +const TracingProcessor = require('../../lib/traces/tracing-processor.js'); const assert = require('assert'); describe('MainResource computed artifact', () => { diff --git a/lighthouse-core/test/gather/computed/manifest-values-test.js b/lighthouse-core/test/computed/manifest-values-test.js similarity index 97% rename from lighthouse-core/test/gather/computed/manifest-values-test.js rename to lighthouse-core/test/computed/manifest-values-test.js index b040d7b8f614..5542d5afe148 100644 --- a/lighthouse-core/test/gather/computed/manifest-values-test.js +++ b/lighthouse-core/test/computed/manifest-values-test.js @@ -7,11 +7,11 @@ /* eslint-env jest */ -const ManifestValues = require('../../../gather/computed/manifest-values'); +const ManifestValues = require('../../computed/manifest-values.js'); const assert = require('assert'); -const manifestSrc = JSON.stringify(require('../../fixtures/manifest.json')); -const manifestParser = require('../../../lib/manifest-parser'); +const manifestSrc = JSON.stringify(require('../fixtures/manifest.json')); +const manifestParser = require('../../lib/manifest-parser.js'); function getMockContext() { return { diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/estimated-input-latency-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/estimated-input-latency-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/estimated-input-latency-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/estimated-input-latency-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/first-contentful-paint-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/first-contentful-paint-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/first-contentful-paint-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/first-contentful-paint-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/first-cpu-idle-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/first-cpu-idle-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/first-cpu-idle-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/first-cpu-idle-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/first-meaningful-paint-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/first-meaningful-paint-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/first-meaningful-paint-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/first-meaningful-paint-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/interactive-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/interactive-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/interactive-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/interactive-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-estimated-input-latency-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/lantern-estimated-input-latency-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-estimated-input-latency-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/lantern-estimated-input-latency-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-first-contentful-paint-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/lantern-first-contentful-paint-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-first-contentful-paint-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/lantern-first-contentful-paint-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-first-cpu-idle-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/lantern-first-cpu-idle-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-first-cpu-idle-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/lantern-first-cpu-idle-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-first-meaningful-paint-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/lantern-first-meaningful-paint-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-first-meaningful-paint-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/lantern-first-meaningful-paint-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-interactive-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/lantern-interactive-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-interactive-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/lantern-interactive-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-speed-index-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/lantern-speed-index-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/lantern-speed-index-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/lantern-speed-index-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/__snapshots__/speed-index-test.js.snap b/lighthouse-core/test/computed/metrics/__snapshots__/speed-index-test.js.snap similarity index 100% rename from lighthouse-core/test/gather/computed/metrics/__snapshots__/speed-index-test.js.snap rename to lighthouse-core/test/computed/metrics/__snapshots__/speed-index-test.js.snap diff --git a/lighthouse-core/test/gather/computed/metrics/estimated-input-latency-test.js b/lighthouse-core/test/computed/metrics/estimated-input-latency-test.js similarity index 89% rename from lighthouse-core/test/gather/computed/metrics/estimated-input-latency-test.js rename to lighthouse-core/test/computed/metrics/estimated-input-latency-test.js index c72f8727dbad..8fb89cb8d397 100644 --- a/lighthouse-core/test/gather/computed/metrics/estimated-input-latency-test.js +++ b/lighthouse-core/test/computed/metrics/estimated-input-latency-test.js @@ -5,11 +5,11 @@ */ 'use strict'; -const EstimatedInputLatency = require('../../../../gather/computed/metrics/estimated-input-latency'); // eslint-disable-line max-len +const EstimatedInputLatency = require('../../../computed/metrics/estimated-input-latency.js'); const assert = require('assert'); -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ diff --git a/lighthouse-core/test/gather/computed/metrics/first-contentful-paint-test.js b/lighthouse-core/test/computed/metrics/first-contentful-paint-test.js similarity index 85% rename from lighthouse-core/test/gather/computed/metrics/first-contentful-paint-test.js rename to lighthouse-core/test/computed/metrics/first-contentful-paint-test.js index 1847ec7939e9..43dd9ea19568 100644 --- a/lighthouse-core/test/gather/computed/metrics/first-contentful-paint-test.js +++ b/lighthouse-core/test/computed/metrics/first-contentful-paint-test.js @@ -7,9 +7,9 @@ const assert = require('assert'); -const FirstContentfulPaint = require('../../../../gather/computed/metrics/first-contentful-paint.js'); // eslint-disable-line max-len -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const FirstContentfulPaint = require('../../../computed/metrics/first-contentful-paint.js'); // eslint-disable-line max-len +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ diff --git a/lighthouse-core/test/gather/computed/metrics/first-cpu-idle-test.js b/lighthouse-core/test/computed/metrics/first-cpu-idle-test.js similarity index 94% rename from lighthouse-core/test/gather/computed/metrics/first-cpu-idle-test.js rename to lighthouse-core/test/computed/metrics/first-cpu-idle-test.js index 34c1c355847d..665aa40676aa 100644 --- a/lighthouse-core/test/gather/computed/metrics/first-cpu-idle-test.js +++ b/lighthouse-core/test/computed/metrics/first-cpu-idle-test.js @@ -5,13 +5,13 @@ */ 'use strict'; -const FirstCPUIdle = require('../../../../gather/computed/metrics/first-cpu-idle'); -const TracingProcessor = require('../../../../lib/traces/tracing-processor'); +const FirstCPUIdle = require('../../../computed/metrics/first-cpu-idle.js'); +const TracingProcessor = require('../../../lib/traces/tracing-processor.js'); -const tooShortTrace = require('../../../fixtures/traces/progressive-app.json'); -const acceptableTrace = require('../../../fixtures/traces/progressive-app-m60.json'); -const acceptableDevtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); // eslint-disable-line max-len -const redirectTrace = require('../../../fixtures/traces/site-with-redirect.json'); +const tooShortTrace = require('../../fixtures/traces/progressive-app.json'); +const acceptableTrace = require('../../fixtures/traces/progressive-app-m60.json'); +const acceptableDevtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); // eslint-disable-line max-len +const redirectTrace = require('../../fixtures/traces/site-with-redirect.json'); const assert = require('assert'); diff --git a/lighthouse-core/test/gather/computed/metrics/first-meaningful-paint-test.js b/lighthouse-core/test/computed/metrics/first-meaningful-paint-test.js similarity index 95% rename from lighthouse-core/test/gather/computed/metrics/first-meaningful-paint-test.js rename to lighthouse-core/test/computed/metrics/first-meaningful-paint-test.js index 3e4533175733..28c0abc9e802 100644 --- a/lighthouse-core/test/gather/computed/metrics/first-meaningful-paint-test.js +++ b/lighthouse-core/test/computed/metrics/first-meaningful-paint-test.js @@ -5,10 +5,10 @@ */ 'use strict'; -const FirstMeaningfulPaint = require('../../../../gather/computed/metrics/first-meaningful-paint.js'); // eslint-disable-line max-len +const FirstMeaningfulPaint = require('../../../computed/metrics/first-meaningful-paint.js'); const assert = require('assert'); -const TRACE_FIXTURES = '../../../fixtures/traces'; +const TRACE_FIXTURES = '../../fixtures/traces'; const pwaTrace = require(`${TRACE_FIXTURES}/progressive-app-m60.json`); const pwaDevtoolsLog = require(`${TRACE_FIXTURES}/progressive-app-m60.devtools.log.json`); diff --git a/lighthouse-core/test/gather/computed/metrics/interactive-test.js b/lighthouse-core/test/computed/metrics/interactive-test.js similarity index 96% rename from lighthouse-core/test/gather/computed/metrics/interactive-test.js rename to lighthouse-core/test/computed/metrics/interactive-test.js index a0b31a98ff77..904923f8943f 100644 --- a/lighthouse-core/test/gather/computed/metrics/interactive-test.js +++ b/lighthouse-core/test/computed/metrics/interactive-test.js @@ -5,12 +5,12 @@ */ 'use strict'; -const Interactive = require('../../../../gather/computed/metrics/interactive'); // eslint-disable-line +const Interactive = require('../../../computed/metrics/interactive.js'); const assert = require('assert'); -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); function generateNetworkRecords(records, navStart) { const navStartInMs = navStart / 1000; diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-estimated-input-latency-test.js b/lighthouse-core/test/computed/metrics/lantern-estimated-input-latency-test.js similarity index 78% rename from lighthouse-core/test/gather/computed/metrics/lantern-estimated-input-latency-test.js rename to lighthouse-core/test/computed/metrics/lantern-estimated-input-latency-test.js index e6f1e0a66f2c..9df8c63d3c9c 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-estimated-input-latency-test.js +++ b/lighthouse-core/test/computed/metrics/lantern-estimated-input-latency-test.js @@ -5,9 +5,9 @@ */ 'use strict'; -const LanternEstimatedInputLatency = require('../../../../gather/computed/metrics/lantern-estimated-input-latency.js'); // eslint-disable-line max-len -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const LanternEstimatedInputLatency = require('../../../computed/metrics/lantern-estimated-input-latency.js'); // eslint-disable-line max-len +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-first-contentful-paint-test.js b/lighthouse-core/test/computed/metrics/lantern-first-contentful-paint-test.js similarity index 82% rename from lighthouse-core/test/gather/computed/metrics/lantern-first-contentful-paint-test.js rename to lighthouse-core/test/computed/metrics/lantern-first-contentful-paint-test.js index 3e42126ebe0d..020bb50ab93e 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-first-contentful-paint-test.js +++ b/lighthouse-core/test/computed/metrics/lantern-first-contentful-paint-test.js @@ -5,11 +5,11 @@ */ 'use strict'; -const LanternFirstContentfulPaint = require('../../../../gather/computed/metrics/lantern-first-contentful-paint.js'); // eslint-disable-line max-len +const LanternFirstContentfulPaint = require('../../../computed/metrics/lantern-first-contentful-paint.js'); // eslint-disable-line max-len const assert = require('assert'); -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ describe('Metrics: Lantern FCP', () => { diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-first-cpu-idle-test.js b/lighthouse-core/test/computed/metrics/lantern-first-cpu-idle-test.js similarity index 87% rename from lighthouse-core/test/gather/computed/metrics/lantern-first-cpu-idle-test.js rename to lighthouse-core/test/computed/metrics/lantern-first-cpu-idle-test.js index cab208bfe7aa..1f404ffec510 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-first-cpu-idle-test.js +++ b/lighthouse-core/test/computed/metrics/lantern-first-cpu-idle-test.js @@ -5,11 +5,11 @@ */ 'use strict'; -const LanternFirstCPUIdle = require('../../../../gather/computed/metrics/lantern-first-cpu-idle.js'); // eslint-disable-line max-len +const LanternFirstCPUIdle = require('../../../computed/metrics/lantern-first-cpu-idle.js'); const assert = require('assert'); -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ describe('Metrics: Lantern TTFCPUI', () => { diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-first-meaningful-paint-test.js b/lighthouse-core/test/computed/metrics/lantern-first-meaningful-paint-test.js similarity index 85% rename from lighthouse-core/test/gather/computed/metrics/lantern-first-meaningful-paint-test.js rename to lighthouse-core/test/computed/metrics/lantern-first-meaningful-paint-test.js index 4111495ac749..1c5829894b0d 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-first-meaningful-paint-test.js +++ b/lighthouse-core/test/computed/metrics/lantern-first-meaningful-paint-test.js @@ -7,10 +7,10 @@ const assert = require('assert'); -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); const LanternFirstMeaningfulPaint = - require('../../../../gather/computed/metrics/lantern-first-meaningful-paint.js'); + require('../../../computed/metrics/lantern-first-meaningful-paint.js'); /* eslint-env jest */ describe('Metrics: Lantern FMP', () => { diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-interactive-test.js b/lighthouse-core/test/computed/metrics/lantern-interactive-test.js similarity index 82% rename from lighthouse-core/test/gather/computed/metrics/lantern-interactive-test.js rename to lighthouse-core/test/computed/metrics/lantern-interactive-test.js index 2b78c74b4744..24930c059218 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-interactive-test.js +++ b/lighthouse-core/test/computed/metrics/lantern-interactive-test.js @@ -5,11 +5,11 @@ */ 'use strict'; -const LanternInteractive = require('../../../../gather/computed/metrics/lantern-interactive.js'); // eslint-disable-line max-len +const LanternInteractive = require('../../../computed/metrics/lantern-interactive.js'); const assert = require('assert'); -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ describe('Metrics: Lantern TTI', () => { diff --git a/lighthouse-core/test/gather/computed/metrics/lantern-speed-index-test.js b/lighthouse-core/test/computed/metrics/lantern-speed-index-test.js similarity index 79% rename from lighthouse-core/test/gather/computed/metrics/lantern-speed-index-test.js rename to lighthouse-core/test/computed/metrics/lantern-speed-index-test.js index 9fa5a2100426..f5cc91656895 100644 --- a/lighthouse-core/test/gather/computed/metrics/lantern-speed-index-test.js +++ b/lighthouse-core/test/computed/metrics/lantern-speed-index-test.js @@ -5,10 +5,10 @@ */ 'use strict'; -const LanternSpeedIndex = require('../../../../gather/computed/metrics/lantern-speed-index.js'); // eslint-disable-line max-len +const LanternSpeedIndex = require('../../../computed/metrics/lantern-speed-index.js'); -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ describe('Metrics: Lantern Speed Index', () => { diff --git a/lighthouse-core/test/gather/computed/metrics/speed-index-test.js b/lighthouse-core/test/computed/metrics/speed-index-test.js similarity index 85% rename from lighthouse-core/test/gather/computed/metrics/speed-index-test.js rename to lighthouse-core/test/computed/metrics/speed-index-test.js index 4048ce0b747d..a1c8c8a55ceb 100644 --- a/lighthouse-core/test/gather/computed/metrics/speed-index-test.js +++ b/lighthouse-core/test/computed/metrics/speed-index-test.js @@ -7,9 +7,9 @@ const assert = require('assert'); -const SpeedIndex = require('../../../../gather/computed/metrics/speed-index.js'); -const trace = require('../../../fixtures/traces/progressive-app-m60.json'); -const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const SpeedIndex = require('../../../computed/metrics/speed-index.js'); +const trace = require('../../fixtures/traces/progressive-app-m60.json'); +const devtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ diff --git a/lighthouse-core/test/gather/computed/page-dependency-graph-test.js b/lighthouse-core/test/computed/page-dependency-graph-test.js similarity index 96% rename from lighthouse-core/test/gather/computed/page-dependency-graph-test.js rename to lighthouse-core/test/computed/page-dependency-graph-test.js index 2059dbee98d3..c0cda7d0d707 100644 --- a/lighthouse-core/test/gather/computed/page-dependency-graph-test.js +++ b/lighthouse-core/test/computed/page-dependency-graph-test.js @@ -5,12 +5,12 @@ */ 'use strict'; -const PageDependencyGraph = require('../../../gather/computed/page-dependency-graph'); -const BaseNode = require('../../../lib/dependency-graph/base-node'); -const NetworkRequest = require('../../../lib/network-request'); +const PageDependencyGraph = require('../../computed/page-dependency-graph.js'); +const BaseNode = require('../../lib/dependency-graph/base-node.js'); +const NetworkRequest = require('../../lib/network-request.js'); -const sampleTrace = require('../../fixtures/traces/progressive-app-m60.json'); -const sampleDevtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); +const sampleTrace = require('../fixtures/traces/progressive-app-m60.json'); +const sampleDevtoolsLog = require('../fixtures/traces/progressive-app-m60.devtools.log.json'); const assert = require('assert'); diff --git a/lighthouse-core/test/gather/computed/screenshots-test.js b/lighthouse-core/test/computed/screenshots-test.js similarity index 89% rename from lighthouse-core/test/gather/computed/screenshots-test.js rename to lighthouse-core/test/computed/screenshots-test.js index 2f32e51a007b..5055ed477dc9 100644 --- a/lighthouse-core/test/gather/computed/screenshots-test.js +++ b/lighthouse-core/test/computed/screenshots-test.js @@ -6,9 +6,9 @@ 'use strict'; /* eslint-env jest */ -const Screenshots = require('../../../gather/computed/screenshots'); +const Screenshots = require('../../computed/screenshots.js'); const assert = require('assert'); -const pwaTrace = require('../../fixtures/traces/progressive-app.json'); +const pwaTrace = require('../fixtures/traces/progressive-app.json'); describe('Screenshot computed artifact', () => { it('returns an artifact for a real trace', () => { diff --git a/lighthouse-core/test/gather/computed/speedline-test.js b/lighthouse-core/test/computed/speedline-test.js similarity index 92% rename from lighthouse-core/test/gather/computed/speedline-test.js rename to lighthouse-core/test/computed/speedline-test.js index feac5a1e04c2..ddad59ad13da 100644 --- a/lighthouse-core/test/gather/computed/speedline-test.js +++ b/lighthouse-core/test/computed/speedline-test.js @@ -9,9 +9,9 @@ const assert = require('assert'); const fs = require('fs'); -const pwaTrace = require('../../fixtures/traces/progressive-app.json'); -const threeFrameTrace = require('../../fixtures/traces/threeframes-blank_content_more.json'); -const Speedline = require('../../../gather/computed/speedline.js'); +const pwaTrace = require('../fixtures/traces/progressive-app.json'); +const threeFrameTrace = require('../fixtures/traces/threeframes-blank_content_more.json'); +const Speedline = require('../../computed/speedline.js'); describe('Speedline gatherer', () => { it('returns an error message on faulty trace data', () => { @@ -75,7 +75,7 @@ describe('Speedline gatherer', () => { it('does not change order of events in traces', () => { // Use fresh trace in case it has been altered by other require()s. const pwaJson = fs.readFileSync(__dirname + - '/../../fixtures/traces/progressive-app.json', 'utf8'); + '/../fixtures/traces/progressive-app.json', 'utf8'); const pwaTrace = JSON.parse(pwaJson); const context = {computedCache: new Map()}; return Speedline.request({traceEvents: pwaTrace}, context) diff --git a/lighthouse-core/test/gather/computed/trace-of-tab-test.js b/lighthouse-core/test/computed/trace-of-tab-test.js similarity index 91% rename from lighthouse-core/test/gather/computed/trace-of-tab-test.js rename to lighthouse-core/test/computed/trace-of-tab-test.js index 1873840264d9..bd6641113081 100644 --- a/lighthouse-core/test/gather/computed/trace-of-tab-test.js +++ b/lighthouse-core/test/computed/trace-of-tab-test.js @@ -5,17 +5,17 @@ */ 'use strict'; -const TraceOfTab = require('../../../gather/computed/trace-of-tab'); +const TraceOfTab = require('../../computed/trace-of-tab.js'); const assert = require('assert'); const fs = require('fs'); -const badNavStartTrace = require('../../fixtures/traces/bad-nav-start-ts.json'); -const lateTracingStartedTrace = require('../../fixtures/traces/tracingstarted-after-navstart.json'); -const preactTrace = require('../../fixtures/traces/preactjs.com_ts_of_undefined.json'); -const noFMPtrace = require('../../fixtures/traces/no_fmp_event.json'); -const noFCPtrace = require('../../fixtures/traces/airhorner_no_fcp'); -const noNavStartTrace = require('../../fixtures/traces/no_navstart_event'); -const backgroundTabTrace = require('../../fixtures/traces/backgrounded-tab-missing-paints'); +const badNavStartTrace = require('../fixtures/traces/bad-nav-start-ts.json'); +const lateTracingStartedTrace = require('../fixtures/traces/tracingstarted-after-navstart.json'); +const preactTrace = require('../fixtures/traces/preactjs.com_ts_of_undefined.json'); +const noFMPtrace = require('../fixtures/traces/no_fmp_event.json'); +const noFCPtrace = require('../fixtures/traces/airhorner_no_fcp.json'); +const noNavStartTrace = require('../fixtures/traces/no_navstart_event.json'); +const backgroundTabTrace = require('../fixtures/traces/backgrounded-tab-missing-paints.json'); /* eslint-env jest */ describe('Trace of Tab computed artifact:', () => { @@ -164,7 +164,7 @@ describe('Trace of Tab computed artifact:', () => { it('stably sorts events', async () => { const traceJson = fs.readFileSync(__dirname + - '/../../fixtures/traces/tracingstarted-after-navstart.json', 'utf8'); + '/../fixtures/traces/tracingstarted-after-navstart.json', 'utf8'); const trace = await TraceOfTab.compute_(JSON.parse(traceJson)); const mainPid = trace.mainThreadEvents[0].pid; diff --git a/lighthouse-core/test/lib/dependency-graph/simulator/network-analyzer-test.js b/lighthouse-core/test/lib/dependency-graph/simulator/network-analyzer-test.js index f7e2934b6f93..4b42606cbcc2 100644 --- a/lighthouse-core/test/lib/dependency-graph/simulator/network-analyzer-test.js +++ b/lighthouse-core/test/lib/dependency-graph/simulator/network-analyzer-test.js @@ -9,7 +9,7 @@ const assert = require('assert'); // eslint-disable-next-line const NetworkAnalyzer = require('../../../../lib/dependency-graph/simulator/network-analyzer'); -const NetworkRecords = require('../../../../gather/computed/network-records.js'); +const NetworkRecords = require('../../../../computed/network-records.js'); const devtoolsLog = require('../../../fixtures/traces/progressive-app-m60.devtools.log.json'); /* eslint-env jest */ diff --git a/lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js b/lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js index 5582dea63d8c..67180dd9eb29 100644 --- a/lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js +++ b/lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js @@ -9,7 +9,7 @@ const NetworkNode = require('../../../../lib/dependency-graph/network-node'); const CpuNode = require('../../../../lib/dependency-graph/cpu-node'); const Simulator = require('../../../../lib/dependency-graph/simulator/simulator'); const DNSCache = require('../../../../lib/dependency-graph/simulator/dns-cache'); -const PageDependencyGraph = require('../../../../gather/computed/page-dependency-graph'); +const PageDependencyGraph = require('../../../../computed/page-dependency-graph.js'); const assert = require('assert'); let nextRequestId = 1; diff --git a/lighthouse-core/test/lib/traces/tracing-processor-test.js b/lighthouse-core/test/lib/traces/tracing-processor-test.js index 065a9b029f25..90e0aee13e2d 100644 --- a/lighthouse-core/test/lib/traces/tracing-processor-test.js +++ b/lighthouse-core/test/lib/traces/tracing-processor-test.js @@ -12,7 +12,7 @@ const TracingProcessor = require('../../../lib/traces/tracing-processor'); const pwaTrace = require('../../fixtures/traces/progressive-app.json'); const defaultPercentiles = [0, 0.25, 0.5, 0.75, 0.9, 0.99, 1]; -const TraceOfTab = require('../../../gather/computed/trace-of-tab'); +const TraceOfTab = require('../../../computed/trace-of-tab.js'); /** * Create a riskPercentiles result object by matching the values in percentiles diff --git a/types/artifacts.d.ts b/types/artifacts.d.ts index b681ae429662..b8ee7ff34d36 100644 --- a/types/artifacts.d.ts +++ b/types/artifacts.d.ts @@ -9,7 +9,7 @@ import _LanternSimulator = require('../lighthouse-core/lib/dependency-graph/simu import _NetworkRequest = require('../lighthouse-core/lib/network-request.js'); import speedline = require('speedline-core'); -type _TaskNode = import('../lighthouse-core/gather/computed/main-thread-tasks').TaskNode; +type _TaskNode = import('../lighthouse-core/computed/main-thread-tasks.js').TaskNode; type LanternSimulator = InstanceType;