import type { NextConfig } from "next";
/**
 * Default private route namespace for hosting Eve as a separate experimental
 * Vercel service behind the Next.js app. {@link WithEveOptions.servicePrefix}
 * defaults to this value.
 */
export declare const EVE_NEXT_SERVICE_PREFIX = "/_eve_internal/eve";
type ArrayElement<T> = T extends readonly (infer TElement)[] ? TElement : never;
type NextRewrites = Awaited<ReturnType<NonNullable<NextConfig["rewrites"]>>>;
/**
 * Next.js rewrite rule that {@link withEve} emits.
 */
export type EveNextRewriteRule = ArrayElement<NextRewrites>;
/**
 * Resolved return type of a Next.js `rewrites` function: an array of rules, or
 * the sectioned `{ beforeFiles, afterFiles, fallback }` object.
 */
export type EveNextRewrites = NextRewrites;
/**
 * Sectioned Next.js rewrite rules.
 */
export type EveNextRewriteSections = Extract<NextRewrites, {
    readonly afterFiles?: EveNextRewriteRule[];
    readonly beforeFiles?: EveNextRewriteRule[];
    readonly fallback?: EveNextRewriteRule[];
}>;
/**
 * Alias of Next.js's `NextConfig`, the config object form {@link withEve}
 * accepts (the other being {@link EveNextConfigFunction}).
 */
export type EveNextConfig = NextConfig;
/**
 * Structural shape of a Next.js config function: receives the build `phase` and
 * a `context` containing `defaultConfig`, and returns a config (or a promise of
 * one). This is the form {@link withEve} returns.
 */
export type EveNextConfigFunction<TConfig extends EveNextConfig = EveNextConfig> = (phase: string, context: {
    readonly defaultConfig: TConfig;
}) => TConfig | Promise<TConfig>;
/**
 * Next.js config input that {@link withEve} accepts.
 */
export type EveNextConfigInput<TConfig extends EveNextConfig = EveNextConfig> = EveNextConfigFunction<TConfig> | TConfig;
/**
 * Options for {@link withEve}.
 */
export interface WithEveOptions {
    /**
     * Maximum time in milliseconds to wait for the Eve development server to
     * start, including waiting for another Next.js process to start it. Defaults
     * to 180000 (three minutes).
     */
    readonly devServerTimeoutMs?: number;
    /**
     * Path to the Eve application root, relative to `process.cwd()` unless
     * absolute. Defaults to the Next.js app root.
     */
    readonly eveRoot?: string;
    /**
     * Build command for the generated Eve Vercel service. Defaults to `eve build`.
     * Use this when the Eve service needs project-specific prework before the
     * framework build, without changing the Next.js service build command.
     */
    readonly eveBuildCommand?: string;
    /**
     * Set to `false` to skip creating or updating Vercel Build Output config.
     * When unset, `withEve` ensures `.vercel/output/config.json` contains
     * `experimentalServices` for the Next.js app and Eve app.
     */
    readonly configureVercelOutput?: boolean;
    /**
     * Private Vercel service prefix for the Eve deployment. Defaults to
     * {@link EVE_NEXT_SERVICE_PREFIX} (`/_eve_internal/eve`). `withEve` normalizes
     * the prefix (adds a leading slash, strips trailing slashes) and rejects a
     * prefix that resolves to the root route. The prefix must match the Eve
     * service's mount in Vercel Build Output config.
     */
    readonly servicePrefix?: string;
}
/**
 * Wraps a Next.js config so same-origin Eve endpoints proxy to a separate Eve
 * service.
 *
 * In development, starts `eve dev --no-repl --port 0` for the Eve app and
 * rewrites Eve protocol endpoints to that local URL. In Vercel production,
 * rewrites to the private Eve service prefix from `.vercel/output/config.json`.
 * Outside Vercel production, serves an existing `.output/server/index.mjs` build
 * on a stable local port when present; otherwise set `EVE_NEXT_PRODUCTION_ORIGIN`
 * to the origin serving the Eve service namespace.
 */
export declare function withEve<TConfig extends EveNextConfig>(configOrFunction: EveNextConfigInput<TConfig>, options?: WithEveOptions): EveNextConfigFunction<TConfig>;
export {};
