Rocky_Mountain_Vending/.pnpm-store/v10/files/8b/6913186f1effcaf37eba708e6d4a06949a86304413749c352fc3087d1988b5cc6bbffdd75ae60729c790afad4fc56739dbec2ee382d60390fd44b0b98e771a
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

58 lines
2 KiB
Text

/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {makeComputedArtifact} from '../computed-artifact.js';
import {LighthouseError} from '../../lib/lh-error.js';
import {LargestContentfulPaint} from './largest-contentful-paint.js';
import {ProcessedNavigation} from '../processed-navigation.js';
import {TimeToFirstByte} from './time-to-first-byte.js';
import {LCPImageRecord} from '../lcp-image-record.js';
class LCPBreakdown {
/**
* @param {LH.Artifacts.MetricComputationDataInput} data
* @param {LH.Artifacts.ComputedContext} context
* @return {Promise<{ttfb: number, loadStart?: number, loadEnd?: number}>}
*/
static async compute_(data, context) {
const processedNavigation = await ProcessedNavigation.request(data.trace, context);
const observedLcp = processedNavigation.timings.largestContentfulPaint;
if (observedLcp === undefined) {
throw new LighthouseError(LighthouseError.errors.NO_LCP);
}
const timeOrigin = processedNavigation.timestamps.timeOrigin / 1000;
const {timing: ttfb} = await TimeToFirstByte.request(data, context);
const lcpRecord = await LCPImageRecord.request(data, context);
if (!lcpRecord) {
return {ttfb};
}
// Official LCP^tm. Will be lantern result if simulated, otherwise same as observedLcp.
const {timing: metricLcp} = await LargestContentfulPaint.request(data, context);
const throttleRatio = metricLcp / observedLcp;
const unclampedLoadStart = (lcpRecord.networkRequestTime - timeOrigin) * throttleRatio;
const loadStart = Math.max(ttfb, Math.min(unclampedLoadStart, metricLcp));
const unclampedLoadEnd = (lcpRecord.networkEndTime - timeOrigin) * throttleRatio;
const loadEnd = Math.max(loadStart, Math.min(unclampedLoadEnd, metricLcp));
return {
ttfb,
loadStart,
loadEnd,
};
}
}
const LCPBreakdownComputed = makeComputedArtifact(
LCPBreakdown,
['devtoolsLog', 'gatherContext', 'settings', 'simulator', 'trace', 'URL', 'SourceMaps']
);
export {LCPBreakdownComputed as LCPBreakdown};