Rocky_Mountain_Vending/.pnpm-store/v10/files/67/5312e30e3fbc7cbd356657bd57d8f047ef8f0d2832cfe66f883d36f9ffdf3ba85726281f5dc88297602175fd0201dddc2f9f51a82d821e83afb2f9bca4d63b
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

49 lines
1.5 KiB
Text

/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {Audit} from './audit.js';
import {JSBundles} from '../computed/js-bundles.js';
class ViolationAudit extends Audit {
/**
* @param {LH.Artifacts} artifacts
* @param {LH.Audit.Context} context
* @param {RegExp} pattern
* @return {Promise<Array<{source: LH.Audit.Details.SourceLocationValue}>>}
*/
static async getViolationResults(artifacts, context, pattern) {
const bundles = await JSBundles.request(artifacts, context);
/**
* @template T
* @param {T} value
* @return {value is Exclude<T, undefined>}
*/
function filterUndefined(value) {
return value !== undefined;
}
const seen = new Set();
return artifacts.ConsoleMessages
.filter(entry => entry.url && entry.source === 'violation' && pattern.test(entry.text))
.map(entry => {
const bundle = bundles.find(bundle => bundle.script.scriptId === entry.scriptId);
return Audit.makeSourceLocationFromConsoleMessage(entry, bundle);
})
.filter(filterUndefined)
.filter(source => {
// Filter out duplicate entries since they are not differentiable to the user
// @see https://github.com/GoogleChrome/lighthouse/issues/5218
const key = `${source.url}!${source.line}!${source.column}`;
if (seen.has(key)) return false;
seen.add(key);
return true;
})
.map(source => ({source}));
}
}
export default ViolationAudit;