/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
packages/devlow-bench/src/interfaces/compare.ts
37 строк
1 KB
Will Binns-Smith
Lint devlow-bench with the root eslint config (#96871)
07 авг 2026, 06:39
Не верифицирован
07 авг 2026, 06:39
007058e
Код
Авторство
О чём код?
import type { Interface } from '../index.js' import { type SampleGroup, groupRows, makeKey, printComparison, } from '../compare.js' import { readSnapshot } from '../snapshot.js' import { formatVariantProps } from '../utils.js' export default async function createInterface(options: { baselinePath: string }): Promise<Interface> { const baselinePath = options.baselinePath const baselineRows = await readSnapshot(baselinePath) const baseline = groupRows(baselineRows) const current = new Map<string, SampleGroup>() return { variantStatistics: async (scenario, props, stats) => { const variant = formatVariantProps(props) for (const [metric, s] of Object.entries(stats)) { const key = makeKey(scenario, variant, metric) current.set(key, { scenario, variant, metric, unit: s.unit, samples: s.samples.slice(), }) } }, finish: async () => { printComparison(baseline, current, { baselineLabel: baselinePath }) }, } }