Skip to content

API

@ogygia/devtools/report

The build report.

On this page

This page is generated from the package’s own .d.ts files on every build, so the signatures, descriptions and examples below always match the source.

import { … } from '@ogygia/devtools/report';

Exports fix_impact · is_dump · is_ogp · ogp_decode · report_json · Forecast

fix_impact

function

"Fix these and the render goes from 754 ms to ~300 ms." Each costly line belongs to one pattern, so the savings add without counting a line twice; the sum is capped at 90 % of the render (an estimate never promises a free page). Undefined without a render to measure against.

UNITS: a CPU pattern's numbers add up the whole recording — renders renders in page mode — while a waiting pattern is measured on ONE render (the network log is scoped to one run). CPU savings are divided by renders so both are per render, like render_ms.

function fix_impact(patterns: readonly Pick<Pattern, "save_ms" | "wait">[], render_ms: number, renders?: number, wait_ms?: number): FixImpact | undefined;

is_dump

function

Narrowing guard for an uploaded dump before we render it.

function is_dump(x: unknown): x is {
  meta: ReportMeta;
  analysis: Analysis;
  extras: ReportExtras;
};

is_ogp

function

True when bytes starts with the .ogp magic (so import can tell it from legacy plain JSON).

function is_ogp(bytes: Uint8Array): boolean;

ogp_decode

function

Decrypt + gunzip .ogp bytes back to the dump object. Throws on a wrong key or a tampered file (the GCM tag fails to verify) — the caller turns that into a "wrong key" message.

function ogp_decode(bytes: Uint8Array, secret: string | undefined): Promise<unknown>;

report_json

function

function report_json(a: Analysis, meta: ReportMeta, base: string, extras: ReportExtras): ReportJson;

Forecast

interface

interface Forecast {/*…*/}

Forecast.now_ms

one render now: the median of the profiled renders, ms, as the app paid it

now_ms: number;

Forecast.after_ms

one render with every fix below, ms (an estimate)

after_ms: number;

Forecast.caps

what the render used, which capped the savings: its waiting and its CPU, ms (the compare's fix check counts a later report's fixes the same way)

caps?: {
    wait?: number;
    cpu?: number;
  };

Forecast.cpu_ms

the parts of the saving: CPU, waiting, and work deleted, ms per render

cpu_ms: number;

Forecast.wait_ms

wait_ms: number;

Forecast.delete_ms

delete_ms: number;

Forecast.cpu_now_ms

the main thread's CPU a render, now and after every fix (ms): what bounds how many renders a core serves — the waiting fixes cut the time a visitor waits, only the CPU ones raise that

cpu_now_ms?: number;

Forecast.cpu_after_ms

cpu_after_ms?: number;

Forecast.parts

the fixes counted, biggest first; with: the other fixes on the same lines, whose saving this one already covers; after_ms: one render once this fix AND every one above it is done

parts: {
    title: string;
    kind: string;
    ms: number;
    wait: boolean;
    after_ms?: number;
    with?: string[];
  }[];

Forecast.answers

caching the services' answers on top (same answer every render): one render after that, and those fixes. A decision about how stale an answer may be, so left out of after_ms

answers?: {
    after_ms: number;
    wait_ms: number;
    parts: Forecast["parts"];
    clamped?: boolean;
    measured?: {
      ms: number;
      renders: number;
      model_ms: number;
    };
  };

Forecast.cache

the whole document is cacheable: a cached copy costs the render nothing — a different lever, left out of after_ms

cache?: boolean;

Forecast.clamped

the savings claimed more waiting or CPU than the render had (they overlap in ways the lines do not show): each was held at what the render used

clamped?: boolean;

Forecast.partial

the build had no sourcemaps: the profiler saw fewer lines, so fewer fixes — the real time after them is likely lower

partial?: boolean;