import { native } from "../native.js";
import type {
	AstFindMatch,
	AstFindOptions,
	AstFindResult,
	AstReplaceChange,
	AstReplaceFileChange,
	AstReplaceOptions,
	AstReplaceResult,
} from "./types.js";

export type {
	AstFindMatch,
	AstFindOptions,
	AstFindResult,
	AstReplaceChange,
	AstReplaceFileChange,
	AstReplaceOptions,
	AstReplaceResult,
};

export function astGrep(options: AstFindOptions): AstFindResult {
	return (native as Record<string, (...args: unknown[]) => unknown>).astGrep(
		options,
	) as AstFindResult;
}

export function astEdit(options: AstReplaceOptions): AstReplaceResult {
	return (native as Record<string, (...args: unknown[]) => unknown>).astEdit(
		options,
	) as AstReplaceResult;
}
