import { Metric } from "../../Metrics/Metric.mjs"; import { Plugin } from "../../Plugin/Plugin.mjs"; //#region src/Plugins/CriticalResources/CriticalResourcePlugin.d.ts /** * Critical Resource Plugin * * A plugin designed to record Critical Path and Cache attributes * for a given metric. This plugin accepts a list of file extensions * and returns the underlying weight of collective resources required * to serve the metric to the browser. The aforementioned resources * are then calculated against any cache-hits producing a cache- * rate percentage * * ```typescript * const metric = new Metric("My Metric", { * resources: new CriticalResourcePlugin(["js", "css"]) * }); * ``` */ declare class CriticalResourcePlugin = Metric> extends Plugin { cacheRate: number; criticalSize: number; extensions: Set; private static readonly browserSupport; constructor(extensions?: string[]); /** * Reset * * Resets the Metric's `cacheRate` and `criticalSize` back * to zero */ protected reset(): void; /** * Stop * * Records the `criticalSize` and `cacheRate` of resources loaded * between the Metric's `start()` and `stop()` events */ protected stop({ startTime, stopTime }: T): void; /** * Iterate Resources * * Filters all loaded resources for those loaded within the * duration of the metric. Returns the total size (`criticalSize`) * and `cacheRate` */ private iterateResources; /** * Parse Extension * * Returns a file extension associated with a given resource */ private parseExtension; /** * To JSON * * Modifies the return value of the `CriticalResourcePlugin` interface * when passed to `JSON.stringify` */ toJSON(): { cacheRate: number; criticalSize: number; extensions: string[]; browserSupport: boolean; }; } //#endregion export { CriticalResourcePlugin };