import type { TSESTree } from '@typescript-eslint/types'; import { type HelperEdit, type SourceEdit } from './helper-edit.js'; import { type AppliedEdit, type EditResult } from './literal-edit.js'; import { type ParsedSource } from './source-file.js'; export type { HelperEdit, SourceEdit }; /** * Applies literal and helper edits to the text of `source` inside `options`, * one of its nodes. Edits are resolved against the original ranges and * spliced from the end of the file backwards, so no edit shifts another. * Two edits that touch the same bytes cannot both be right: a replacement * wins over an insertion into the object it replaces, and otherwise the * first listed wins; the loser is skipped. Replacements are reported before * insertions. An edit whose text equals what the code already holds is * neither applied nor skipped: there is nothing to do. * * A helper edit that references a class the file does not import gets it * added to the file's `checkly/constructs` import in the same pass; when * that is not possible, the edit is skipped with the reason. The result is * text only: to edit it again, parse it again. */ export declare function applyEdits(source: ParsedSource, options: TSESTree.ObjectExpression, edits: readonly SourceEdit[]): EditResult; /** * Whether a re-parse of the edited text holds, at the edit's path, what the * edit meant: the value a literal evaluates to, or the expression a helper * edit was rendered from (its classes under the names it was rendered with). * A splice that produced anything else is a bug, and the user's source is * not the place to find out. */ export declare function readsBack(options: TSESTree.ObjectExpression, edit: AppliedEdit): boolean;