import { UUID } from "./uuid"; export declare const MarkersKind: { readonly Markers: "org.openrewrite.marker.Markers"; readonly NamedStyles: "org.openrewrite.style.NamedStyles"; readonly SearchResult: "org.openrewrite.marker.SearchResult"; readonly ParseExceptionResult: "org.openrewrite.ParseExceptionResult"; readonly MarkupError: "org.openrewrite.marker.Markup$Error"; readonly MarkupWarn: "org.openrewrite.marker.Markup$Warn"; readonly MarkupInfo: "org.openrewrite.marker.Markup$Info"; readonly MarkupDebug: "org.openrewrite.marker.Markup$Debug"; readonly RecipesThatMadeChanges: "org.openrewrite.marker.RecipesThatMadeChanges"; readonly RecipeThatMadeChanges: "org.openrewrite.marker.RecipeThatMadeChanges"; /** * A generic marker that is sent/received as a bare map because the type hasn't been * defined in both Java and JavaScript. */ readonly RpcMarker: "org.openrewrite.rpc.RpcMarker"; }; export interface Marker { readonly kind: string; readonly id: UUID; } export declare function marker(id: UUID, data?: {}): Marker; export declare function markers(...markers: Marker[]): Markers; export interface Markers { readonly kind: typeof MarkersKind.Markers; readonly id: UUID; readonly markers: Marker[]; } export declare function findMarker(o: { markers: Markers; }, kind: T["kind"]): T | undefined; /** * Replaces a marker in a Markers collection with a new marker. * If the old marker is not found, the new marker is added. * * @param markers The markers collection to update * @param oldMarker The marker to replace (matched by id) * @param newMarker The new marker to insert * @returns A new Markers object with the replacement applied */ export declare function replaceMarker(markers: Markers, oldMarker: Marker, newMarker: Marker): Markers; /** * Replaces the first marker with the same kind as the new marker, or adds it if not found. * This is useful when there's typically only one marker of each kind. * * @param markers The markers collection to update * @param newMarker The new marker to insert (its kind is used to find the marker to replace) * @returns A new Markers object with the replacement applied */ export declare function replaceMarkerByKind(markers: Markers, newMarker: Marker): Markers; export declare const emptyMarkers: Markers; /** * One frame of a {@link RecipesThatMadeChanges} stack: how the recipe is named, how it was * configured, and what it is worth. */ export interface RecipeThatMadeChanges { readonly kind: typeof MarkersKind.RecipeThatMadeChanges; readonly name: string; readonly displayName?: string; readonly instanceName?: string; /** * Configured option values. JavaScript never interprets them. */ readonly options?: { [name: string]: any; }; readonly estimatedEffortPerOccurrenceMillis?: number; } /** * Records which recipe stacks changed a source file. JavaScript holds the stacks without * interpreting them, so a marker served to this peer returns to the host intact. */ export interface RecipesThatMadeChanges extends Marker { readonly kind: typeof MarkersKind.RecipesThatMadeChanges; readonly recipes: RecipeThatMadeChanges[][]; } export interface SearchResult extends Marker { readonly kind: typeof MarkersKind.SearchResult; readonly description?: string; } export declare function foundSearchResult(t: T, description?: string): T; export interface ParseExceptionResult extends Marker { readonly kind: typeof MarkersKind.ParseExceptionResult; readonly parserType: string; readonly exceptionType: string; readonly message: string; readonly treeType?: string; } /** * Base interface for Markup markers that attach messages to AST nodes. * Used for errors, warnings, info, and debug messages. */ export interface Markup extends Marker { readonly message: string; readonly detail?: string; } export interface MarkupError extends Markup { readonly kind: typeof MarkersKind.MarkupError; } export interface MarkupWarn extends Markup { readonly kind: typeof MarkersKind.MarkupWarn; } export interface MarkupInfo extends Markup { readonly kind: typeof MarkersKind.MarkupInfo; } export interface MarkupDebug extends Markup { readonly kind: typeof MarkersKind.MarkupDebug; } /** * Attaches an error marker to a tree node. */ export declare function markupError(t: T, message: string, detail?: string): T; /** * Attaches a warning marker to a tree node. */ export declare function markupWarn(t: T, message: string, detail?: string): T; /** * Attaches an info marker to a tree node. */ export declare function markupInfo(t: T, message: string, detail?: string): T; /** * Attaches a debug marker to a tree node. */ export declare function markupDebug(t: T, message: string, detail?: string): T; //# sourceMappingURL=markers.d.ts.map