/** * @fileoverview Assemble a {@link Sidecar} from resolved spans + * attributions + landmark/path pairs. * * Pure function: no I/O, no parser, no global state. The AST landmark * resolution step (plan §4.2) is *not* done here — the caller passes * pre-resolved `(landmark, path)` pairs alongside each span. This * separation is deliberate: * * - The sidecar shape + interning logic can be tested without a * parser (`FakeParser` is enough). * - When tsc / oxc adapters land (plan §8), they're swap-ins behind * the `ParserAdapter` interface — no churn here. * * `writeSidecar` (Phase D) is the thin I/O wrapper. It stays separate * so the pure builder can be exercised independently with a temp dir. */ import type { Span, Attribution } from './types.js'; import { type Sidecar, type RegistryEntry } from './sidecar.js'; /** * One (span, attribution, landmark) triple — the input unit for * `buildSidecar`. `landmark` is the top-level export name the span * lives under (empty string when the span sits outside any landmark, * which the builder treats as a skip). `path` is the AST child-index * trail inside the landmark; empty path means "the landmark itself". */ export type ResolvedAnchor = { span: Span; attribution: Attribution; landmark: string; path: number[]; /** * Generator metadata for the producer that owns this span. The * `attribute()` step gives us only the generator id; the version + * registry come from the CLI's view of `deno.json`/lockfile (Phase * D plumbs this). For now callers pass it in; the builder takes * whatever they hand over and pools it. */ generatorVersion: string; registry: RegistryEntry; }; export type BuildSidecarArgs = { filePath: string; schemaSrc: string; parser: string; anchors: ResolvedAnchor[]; }; /** * Assemble a Sidecar v2 from resolved anchors. Anchors with an empty * `landmark` string are skipped — they sit outside any top-level * export and have no useful re-resolution path (plan #25). */ export declare const buildSidecar: ({ filePath, schemaSrc, parser, anchors }: BuildSidecarArgs) => Sidecar;