import type { Artifact, BytecodeDebugInfoSource, DebugMetadataAsset, SourceMapDebugSource } from './types.js'; /** * Find an {@link Artifact} by `filename` (e.g. `main-thread.js`, * `background.fd311de1.js`, `main.css`). * * @public */ export declare function findArtifact(metadata: DebugMetadataAsset, query: { filename: string; }): Artifact | undefined; /** * Find a `source-map` {@link SourceMapDebugSource} by `path`, * `filename`, or `key`. At least one of the three should be set; * every comparison is an exact equality on the field of the same * name on {@link SourceMapDebugSource}. * * @public */ export declare function findSourceMap(metadata: DebugMetadataAsset, query: { path?: string; filename?: string; key?: string; }): SourceMapDebugSource | undefined; /** * Find a `bytecode-debug-info` source attached to the artifact named * `filename`. * * @public */ export declare function findBytecodeDebugInfo(metadata: DebugMetadataAsset, query: { filename: string; }): BytecodeDebugInfoSource | undefined; /** * Parameters every resolver receives. Resolvers pick the keys they need. * * @public */ export interface QueryParams { /** Bundler-relative asset path (e.g. `.rspeedy/main/main-thread.js.map`). */ path?: string; /** Asset basename (e.g. `main-thread.js`). */ filename?: string; /** Chunk hash / release identifier. */ key?: string; } /** * Describes how to look up one queryable field and (optionally) which * sub-field of the matched value to return to callers. * * `resolve` runs the lookup. `payload` is an optional unwrapper: for a * `source-map` query, the resolver returns the full * {@link SourceMapDebugSource} wrapper but HTTP consumers typically want * the raw Source Map v3 JSON — `payload: sm => sm.map` performs the * unwrap. * * @public */ export interface FieldResolver { resolve(metadata: DebugMetadataAsset, params: QueryParams): T | undefined; payload?(value: T): unknown; } /** * Field name → resolver. **HTTP layers read this directly.** Mutations * are honoured by the next request — the export is a live `Map` so * plugins can register their own fields at startup. * * Adding a new field is a one-line `FIELDS.set('your-name', { ... })`. * * @public */ export declare const FIELDS: Map; /** * Result of {@link resolveField}. * * @public */ export interface ResolveResult { /** `true` when the resolver matched; `false` when the field is known * but no value matched (HTTP layer → 404). */ found: boolean; /** Present only when `found`. The value to JSON-serialize back to the * client (already unwrapped via `FieldResolver.payload`). */ payload?: unknown; } /** * Resolve a `?field=…` query against parsed metadata. * * - Returns `undefined` when the field is not registered — HTTP layer * responds `400 invalid_field` and lists `knownFields()`. * - Returns `{found: false}` when the field is valid but no value * matched — HTTP layer responds `404`. * - Returns `{found: true, payload}` when matched. `payload` is the * already-unwrapped value (resolver's `payload` hook applied). * * @public */ export declare function resolveField(metadata: DebugMetadataAsset, field: string, params?: QueryParams): ResolveResult | undefined; /** * All currently-registered field names. Use for `400 invalid_field` * responses so the listing auto-updates when new fields are registered. * * @public */ export declare function knownFields(): string[];