Rocky_Mountain_Vending/.pnpm-store/v10/files/02/819a342a419493a55a9c4b00b66bc06b2bed9bc23f347b3fd3c9a63332325d66032359cf6d40207c2365e6a8163f1bb6e6924fe1706fe68084d55983d799eb
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

64 lines
2.2 KiB
Text

/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {UIStrings} from '@paulirish/trace_engine/models/trace/insights/Cache.js';
import {Audit} from '../audit.js';
import * as i18n from '../../lib/i18n/i18n.js';
import {adaptInsightToAuditProduct} from './insight-audit.js';
// eslint-disable-next-line max-len
const str_ = i18n.createIcuMessageFn('node_modules/@paulirish/trace_engine/models/trace/insights/Cache.js', UIStrings);
class CacheInsight extends Audit {
/**
* @return {LH.Audit.Meta}
*/
static get meta() {
return {
id: 'cache-insight',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.title),
description: str_(UIStrings.description),
guidanceLevel: 3,
requiredArtifacts: ['Trace', 'SourceMaps'],
replacesAudits: ['uses-long-cache-ttl'],
};
}
/**
* @param {LH.Artifacts} artifacts
* @param {LH.Audit.Context} context
* @return {Promise<LH.Audit.Product>}
*/
static async audit(artifacts, context) {
return adaptInsightToAuditProduct(artifacts, context, 'Cache', (insight) => {
/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
/* eslint-disable max-len */
{key: 'url', valueType: 'url', label: str_(UIStrings.requestColumn)},
{key: 'cacheLifetimeMs', valueType: 'ms', label: str_(UIStrings.cacheTTL), displayUnit: 'duration'},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize), displayUnit: 'kb', granularity: 1},
/* eslint-enable max-len */
];
// TODO: this should be the sorting in the model (instead it sorts by transfer size...)
const values = insight.requests.sort((a, b) => b.wastedBytes - a.wastedBytes);
/** @type {LH.Audit.Details.Table['items']} */
const items = values.map(value => ({
url: value.request.args.data.url,
cacheLifetimeMs: value.ttl * 1000,
totalBytes: value.request.args.data.encodedDataLength || 0,
wastedBytes: value.wastedBytes,
}));
return Audit.makeTableDetails(headings, items, {
sortedBy: ['wastedBytes'],
skipSumming: ['cacheLifetimeMs'],
});
});
}
}
export default CacheInsight;