import { NextConfig } from 'next';

type TransformKeys = 'assetPrefix' | 'buildId' | 'draftMode' | 'redirects' | 'rewrites' | 'transpilePackages' | 'webpack';

interface WithMicrofrontendsOptions {
    /**
     * Explicitly set the name of the application instead of using the name from the package.json.
     * This option is useful for cases where you are trying to import next.config.js in a different
     * package, such as for the Storybook Next.js integration.
     *
     * NOTE: This option should not be used in most cases. Issues on Vercel may occur
     * if it differs from the project name.
     */
    appName?: string;
    /**
     * @deprecated this is a no-op, and will be removed in a future version.
     * It is not necessary to specify this option.
     */
    isProduction?: boolean;
    debug?: boolean;
    skipTransforms?: TransformKeys[];
    /**
     * True to enable support for Next.js pages router. This is disabled by
     * default since it modifies Webpack chunking behavior, so it should only be
     * enabled when necessary.
     */
    supportPagesRouter?: boolean;
    /**
     * @deprecated Use VC_MICROFRONTENDS_CONFIG_FILE_NAME instead. This option is
     * deprecated and will be removed in a future release. The env var enables the
     * vercel build to also read the custom config file / path.
     * @see https://vercel.com/docs/microfrontends/configuration#file-naming
     */
    configPath?: string;
}

/**
 * Automatically configures your Next.js application to work with microfrontends.
 *
 * This function should wrap your Next.js config object before it is exported. It
 * will automatically set up the necessary fields and environment variables for
 * microfrontends to work.
 *
 * See the [Getting Started](https://vercel.com/docs/microfrontends/quickstart) guide for more information.
 *
 * @example Wrapping your Next.js config
 * ```js
 * import { withMicrofrontends } from '@vercel/microfrontends/next/config';
 *
 * const nextConfig = { ... };
 *
 * export default withMicrofrontends(nextConfig);
 * ```
 */
declare function withMicrofrontends(nextConfig: NextConfig, opts?: WithMicrofrontendsOptions): NextConfig;

export { withMicrofrontends };
