Browser Result Shapes
Homeboy extensions share a small product-neutral vocabulary for browser,
profile, and trace results in scripts/lib/browser-result-shapes.cjs and
scripts/lib/browser-result-shapes.mjs.
These helpers describe transportable shapes only. Product semantics stay in the
extension that owns them. For example, WordPress REST route normalization,
preload attribution, and route grouping remain in wordpress.
Shared Helpers
normalizeBrowserPerformanceProfile(profile)returns a stable profile envelope withschema_version,page_url,summary, timing arrays,phase_marks, and computedphases.normalizeBrowserProfileTimings(profile, { normalizeUrl })adapts a profile’sresourcesplusnetworkrows into timing rows suitable for correlation.normalizeBrowserTiming(entry, { normalizeUrl })adapts loose resource or network rows to{ url, normalizedUrl, method, status, startTime, ttfbMs, durationMs, initiatorType, phase, raw }.normalizeBrowserArtifact(artifact)returns stable artifact metadata withpath, optionalkind, and optionallabel.normalizeBrowserBottleneck(row)returns stable bottleneck rows withkind,phase,message, and optionaldata.normalizeTraceEvent(),normalizeTraceAssertion(), andnormalizeTraceEnvelope()describe generic trace timelines and assertions.
Shape Boundary
Shared browser result shapes are intentionally narrow:
- Network request rows capture URL, method, resource type, status, failure, start time, and duration.
- Resource timing rows preserve browser timing fields and become correlation
rows through
normalizeBrowserTiming(). - Timeline phases are phase marks plus computed phase windows.
- Artifacts describe where evidence lives and what broad kind it is.
- Bottlenecks describe generic report rows without product-specific meaning.
Callers pass their own normalizeUrl when URL semantics matter. WordPress uses
that hook to preserve its existing REST/cache-busting behavior without moving
route semantics into shared code.
Current Consumers
nodejs/scripts/bench/browser-helper.mjsemits browser profile, artifact, and bottleneck shapes through the shared helpers.nodejs/scripts/trace/lib/timeline.mjsemits trace events, assertions, artifacts, and envelopes through the shared helpers.wordpress/lib/timing-correlator.jsadapts browser profiles through the shared timing helpers while keeping WordPress-specific URL normalization local.