import type { TtscUnpluginOptions } from "./core/options.mjs"; /** * Minimal structural type for a Next.js configuration object. * * Only `webpack` and `turbopack` are used by this adapter; all other Next.js * options are forwarded as-is through the spread operator. */ export type NextLikeConfig = Record & { /** * Optional existing webpack customisation hook. When the caller has already * defined one, `next()` will chain through to it after injecting the ttsc * webpack plugin. */ webpack?: (config: WebpackLikeConfig, options: unknown) => WebpackLikeConfig; /** * Optional existing Turbopack configuration. Preserved whole; only the ttsc * rules are merged into its `rules` map. */ turbopack?: TurbopackLikeConfig; }; /** * Minimal structural type for a webpack configuration object as seen by the * Next.js `webpack` hook callback. */ export type WebpackLikeConfig = Record & { /** The webpack plugin array; initialised to `[]` by this adapter if absent. */ plugins?: unknown[]; }; /** Minimal structural type for Next.js's `turbopack` configuration block. */ export type TurbopackLikeConfig = Record & { /** Per-glob loader rules. Other Turbopack settings are preserved untouched. */ rules?: Record; }; /** * Wrap a Next.js config object so that ttsc runs under whichever bundler * Next.js uses. * * The webpack plugin is injected through the `webpack` hook, and the Turbopack * loader is wired through `turbopack.rules`, with the same options reaching * both. Covering only webpack meant that a project on Turbopack, which is the * default bundler in current Next majors, silently got no transform at all: the * build succeeded and every plugin-driven construct in it, a typia * `assert()` above all, survived untransformed into a runtime failure * (samchon/ttsc#1310). * * Both halves are additive. An existing `webpack` hook is preserved and called * after the plugin is injected, and an existing `turbopack` block keeps every * setting and every rule it already had. * * @param nextConfig - The caller's existing Next.js config (spread into the * returned object unchanged, except for `webpack` and `turbopack`). * @param options - Ttsc plugin options forwarded to both bundlers. */ export default function next(nextConfig?: NextLikeConfig, options?: TtscUnpluginOptions): NextLikeConfig; /** * Measured project-wide Turbopack globs and the source extensions each covers. * * Exported so the packed-package E2E can measure the exact production allowlist * instead of maintaining a second list that can drift from it. */ export declare const TURBOPACK_PROJECT_WIDE_GLOB_COVERAGE: ReadonlyArray;