import { Defu } from "defu"; import { TSConfig } from "pkg-types"; import { InputObject, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1 } from "untyped"; import { IncomingMessage, Server, ServerResponse } from "node:http"; import { AssetURLTagConfig } from "@vue/compiler-sfc"; import { CompilerOptions } from "@vue/compiler-core"; import { AriaAttributes, DataKeys, GlobalAttributes, RenderSSRHeadOptions, SerializableHead } from "@unhead/vue/types"; import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer"; import { PluginVisualizerOptions } from "rollup-plugin-visualizer"; import { TransformerOptions } from "unctx/transform"; import { ConfigLayerMeta, DefineConfig, DotenvOptions, ResolvedConfig, SourceOptions, UserInputConfig } from "c12"; import { CompatibilityDateSpec } from "compatx"; import { Ignore, Options } from "ignore"; import { ChokidarOptions } from "chokidar"; import { CorsOptions, H3CorsOptions } from "h3"; import { NuxtLinkOptions } from "nuxt/app"; import { FetchOptions } from "ofetch"; import { Options as Options$1 } from "autoprefixer"; import { Options as Options$2 } from "cssnano"; import { RawVueCompilerOptions } from "@vue/language-core"; import { PluginOptions } from "mini-css-extract-plugin"; import { LoaderOptions } from "esbuild-loader"; import { Options as Options$3 } from "pug"; import { VueLoaderOptions } from "vue-loader"; import { BasePluginOptions, DefinedDefaultMinimizerAndOptions } from "css-minimizer-webpack-plugin"; import { Compiler, Configuration, Stats, WebpackError } from "webpack"; import { ProcessOptions } from "postcss"; import { Options as Options$4 } from "webpack-dev-middleware"; import { ClientOptions, MiddlewareOptions } from "webpack-hot-middleware"; import { AppConfig as AppConfig$1, KeepAliveProps, TransitionProps } from "vue"; import { TransformOptions } from "oxc-transform"; import { TransformOptions as TransformOptions$1 } from "esbuild"; import { RouteLocationNormalizedGeneric, RouteLocationRaw, RouteRecordRaw, RouterHistory, RouterOptions as RouterOptions$1 } from "vue-router"; import { Server as Server$1 } from "node:https"; import { ServerOptions, UserConfig, ViteDevServer } from "vite"; import { Manifest } from "vue-bundle-renderer"; import { Import, InlinePreset, Preset, Unimport, UnimportOptions } from "unimport"; import { Options as Options$5 } from "@vitejs/plugin-vue"; import { Options as Options$6 } from "@vitejs/plugin-vue-jsx"; import { SnakeCase } from "scule"; import { AsyncLocalStorage } from "node:async_hooks"; import { Hookable } from "hookable"; interface NuxtCompatibility { /** * Required nuxt version in semver format. * @example `^3.2.0` or `>=3.13.0`. */ nuxt?: string; /** * Mark a builder as incompatible, or require a particular version. * * @example * ```ts * export default defineNuxtModule({ * meta: { * name: 'my-module', * compatibility: { * builder: { * // marking as incompatible * webpack: false, * // you can require a (semver-compatible) version * vite: '^5' * } * } * } * // ... * }) * ``` */ builder?: Partial>; } interface NuxtCompatibilityIssue { name: string; message: string; } interface NuxtCompatibilityIssues extends Array { /** * Return formatted error message. */ toString(): string; } type RouterOptions = Partial> & { history?: (baseURL?: string) => RouterHistory | null | undefined; routes?: (_routes: RouterOptions$1["routes"]) => RouterOptions$1["routes"] | Promise; hashMode?: boolean; scrollBehaviorType?: "smooth" | "auto"; }; type RouterConfig = RouterOptions; /** * Only JSON serializable router options are configurable from nuxt config */ type RouterConfigSerializable = Pick; interface ModuleMeta { /** Module name. */ name?: string; /** Module version. */ version?: string; /** * The configuration key used within `nuxt.config` for this module's options. * For example, `@nuxtjs/axios` uses `axios`. */ configKey?: string; /** * Constraints for the versions of Nuxt or features this module requires. */ compatibility?: NuxtCompatibility; /** * Fully resolved path used internally by Nuxt. Do not depend on this value. * @internal */ rawPath?: string; /** * Whether the module has been disabled in the Nuxt configuration. * @internal */ disabled?: boolean; [key: string]: unknown; } /** The options received. */ type ModuleOptions = Record; type ModuleSetupInstallResult = { /** * Timing information for the initial setup */ timings?: { /** Total time took for module setup in ms */setup?: number; [key: string]: number | undefined; }; }; type Awaitable = T | Promise; type Prettify = { [K in keyof T]: T[K] } & {}; type ModuleSetupReturn = Awaitable; type ResolvedModuleOptions> = Prettify, [Partial, TOptionsDefaults]>>; interface ModuleDependencyMeta> { version?: string; overrides?: Partial; defaults?: Partial; optional?: boolean; } interface ModuleDependencies { [key: string]: ModuleDependencyMeta>; } /** Module definition passed to 'defineNuxtModule(...)' or 'defineNuxtModule().with(...)'. */ interface ModuleDefinition, TWith extends boolean> { meta?: ModuleMeta; defaults?: TOptionsDefaults | ((nuxt: Nuxt) => Awaitable); schema?: TOptions; hooks?: Partial; moduleDependencies?: ModuleDependencies | ((nuxt: Nuxt) => Awaitable); onInstall?: (nuxt: Nuxt) => Awaitable; onUpgrade?: (nuxt: Nuxt, options: TOptions, previousVersion: string) => Awaitable; setup?: (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions : TOptions, nuxt: Nuxt) => ModuleSetupReturn; } interface NuxtModule = Partial, TWith extends boolean = false> { (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions : TOptions, nuxt: Nuxt): ModuleSetupReturn; getOptions?: (inlineOptions?: Partial, nuxt?: Nuxt) => Promise : TOptions>; getModuleDependencies?: (nuxt: Nuxt) => Awaitable | undefined; getMeta?: () => Promise; onInstall?: (nuxt: Nuxt) => Awaitable; onUpgrade?: (nuxt: Nuxt, options: TWith extends true ? ResolvedModuleOptions : TOptions, previousVersion: string) => Awaitable; } interface NuxtDebugContext { /** * Module mutation records to the `nuxt` instance. */ moduleMutationRecords?: NuxtDebugModuleMutationRecord[]; } interface NuxtDebugModuleMutationRecord { module: NuxtModule; keys: (string | symbol)[]; target: "nuxt.options"; value: any; method?: string; timestamp: number; } interface NuxtDebugOptions { /** Debug for Nuxt templates */ templates?: boolean; /** Debug for modules setup timings */ modules?: boolean; /** Debug for file watchers */ watchers?: boolean; /** Debug for production hydration mismatch */ hydration?: boolean; /** Debug for Vue Router */ router?: boolean; /** Debug for hooks, can be set to `true` or an object with `server` and `client` keys */ hooks?: boolean | { server?: boolean; client?: boolean; }; /** * Profile startup/build performance. * * - `true` — full report printed to console, JSON + `.cpuprofile` written on exit * - `'quiet'` — JSON + `.cpuprofile` written on exit with no console output * * Activated via `nuxi dev --profile=verbose`, `nuxi dev --profile` (quiet), * `NUXT_DEBUG_PERF=1` (or `=quiet`), or `debug: { perf: true }` in nuxt.config. * @since 4.4.0 */ perf?: boolean | "quiet"; } interface NuxtPlugin { /** @deprecated use mode */ ssr?: boolean; src: string; mode?: "all" | "server" | "client"; /** * This allows more granular control over plugin order and should only be used by advanced users. * Lower numbers run first, and user plugins default to `0`. * * Default Nuxt priorities can be seen at [here](https://github.com/nuxt/nuxt/blob/9904849bc87c53dfbd3ea3528140a5684c63c8d8/packages/nuxt/src/core/plugins/plugin-metadata.ts#L15-L34). */ order?: number; /** * @internal */ name?: string; } type TemplateDefaultOptions = Record; interface NuxtTemplate { /** resolved output file path (generated) */ dst?: string; /** The target filename once the template is copied into the Nuxt buildDir */ filename?: string; /** An options object that will be accessible within the template via `<% options %>` */ options?: Options; /** The resolved path to the source file to be template */ src?: string; /** Provided compile option instead of src */ getContents?: (data: { nuxt: Nuxt; app: NuxtApp; options: Options; }) => string | Promise; /** Write to filesystem */ write?: boolean; /** * The source path of the template (to try resolving dependencies from). * @internal */ _path?: string; } interface NuxtServerTemplate { /** The target filename once the template is copied into the Nuxt buildDir */ filename: string; getContents: () => string | Promise; } interface ResolvedNuxtTemplate extends NuxtTemplate { filename: string; dst: string; modified?: boolean; } interface NuxtTypeTemplate extends Omit, "write" | "filename"> { filename: `${string}.d.ts`; write?: true; } type _TemplatePlugin = Omit & NuxtTemplate; interface NuxtPluginTemplate extends _TemplatePlugin {} interface NuxtApp { mainComponent?: string | null; rootComponent?: string | null; errorComponent?: string | null; dir: string; extensions: string[]; plugins: NuxtPlugin[]; components: Component[]; layouts: Record; middleware: NuxtMiddleware[]; templates: NuxtTemplate[]; configs: string[]; pages?: NuxtPage[]; } interface Nuxt { "__name": string; "_version": string; "_ignore"?: Ignore; "_dependencies"?: Set; "~runtimeDependencies"?: string[]; "_debug"?: NuxtDebugContext; /** * Performance profiler instance, available when `debug.perf` is enabled. * @internal */ "_perf"?: { startPhase: (name: string) => void; endPhase: (name?: string) => void; collectModuleTimings: (modules: Array<{ meta?: { name?: string; }; timings?: Record; }>) => void; recordBundlerPluginHook: (pluginName: string, hookName: string, durationMs: number, startTime?: number) => void; printReport: (options?: { title?: string; }) => void; writeReport: (buildDir: string, options?: { quiet?: boolean; }) => string; dispose: () => void; }; /** Async local storage for current running Nuxt module instance. */ "_asyncLocalStorageModule"?: AsyncLocalStorage; /** * Module options functions collected from moduleDependencies. * @internal */ "_moduleOptionsFunctions"?: Map { defaults?: Record; overrides?: Record; }>>; /** The resolved Nuxt configuration. */ "options": NuxtOptions; "hooks": Hookable; "hook": Nuxt["hooks"]["hook"]; "callHook": Nuxt["hooks"]["callHook"]; "addHooks": Nuxt["hooks"]["addHooks"]; "runWithContext": any>(fn: T) => ReturnType; "ready": () => Promise; "close": () => Promise; /** The production or development server. */ "server"?: any; "vfs": Record; "apps": Record; } type MetaObjectRaw = SerializableHead; type MetaObject = MetaObjectRaw; type AppHeadMetaObject = MetaObjectRaw & { /** * The character encoding in which the document is encoded => `` */ charset?: string; /** * Configuration of the viewport (the area of the window in which web content can be seen), * mapped to => `` */ viewport?: string; }; type SerializableHtmlAttributes = GlobalAttributes & AriaAttributes & DataKeys; type DeepPartial = T extends Function ? T : T extends Record ? { [P in keyof T]?: DeepPartial } : T; type UpperSnakeCase = Uppercase>; declare const message: symbol; type RuntimeValue = T & { [message]?: B; } | T; type Overrideable, Path extends string = ""> = { [K in keyof T]?: K extends string ? unknown extends T[K] ? unknown : T[K] extends Record ? RuntimeValue}`>, `You can override this value at runtime with NUXT${Path}_${UpperSnakeCase}`> : RuntimeValue}`> : K extends number ? T[K] : never }; type RuntimeConfigNamespace = Record; interface PublicRuntimeConfig extends RuntimeConfigNamespace {} interface RuntimeConfig extends RuntimeConfigNamespace { public: PublicRuntimeConfig; } /** * User configuration in `nuxt.config` file */ interface NuxtConfig extends DeepPartial> { components?: ConfigSchema["components"]; vue?: Omit, "config"> & { config?: Partial>; }; vite?: ConfigSchema["vite"]; runtimeConfig?: Overrideable; webpack?: DeepPartial & { $client?: DeepPartial; $server?: DeepPartial; }; /** * Experimental custom config schema * @see [Nuxt Issue #15592](https://github.com/nuxt/nuxt/issues/15592) */ $schema?: SchemaDefinition$1; } type NuxtConfigLayer = ResolvedConfig & { cwd: string; configFile: string; }; interface DefineNuxtConfig extends DefineConfig {} interface NuxtBuilder { bundle: (nuxt: Nuxt) => Promise; } interface NuxtOptions extends Omit { vue: Omit & { config?: Partial>; }; sourcemap: Required>; debug: Required>; builder: "@nuxt/vite-builder" | "@nuxt/webpack-builder" | "@nuxt/rspack-builder" | NuxtBuilder; postcss: Omit & { order: Exclude; }; webpack: ConfigSchema["webpack"] & { $client: ConfigSchema["webpack"]; $server: ConfigSchema["webpack"]; }; _layers: readonly NuxtConfigLayer[]; $schema: SchemaDefinition$1; } interface ViteConfig extends Omit { /** The path to the entrypoint for the Vite build. */ entry?: string; /** * Options passed to @vitejs/plugin-vue. * @see [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) */ vue?: Options$5; /** * Options passed to @vitejs/plugin-vue-jsx. * @see [@vitejs/plugin-vue-jsx.](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) */ vueJsx?: Options$6; /** * Warmup vite entrypoint caches on dev startup. */ warmupEntry?: boolean; /** * Use environment variables or top level `server` options to configure Nuxt server. */ server?: Omit; /** * Directly configuring the `vite.publicDir` option is not supported. Instead, set `dir.public`. * * You can read more in . * @deprecated */ publicDir?: never; } interface ViteOptions extends ViteConfig {} interface CustomAppConfig { [key: string]: unknown; } interface AppConfigInput extends CustomAppConfig { /** @deprecated reserved */ private?: never; /** @deprecated reserved */ nuxt?: never; /** @deprecated reserved */ nitro?: never; /** @deprecated reserved */ server?: never; } type Serializable = T extends Function ? never : T extends Promise ? Serializable : T extends string & {} ? T : T extends Record ? { [K in keyof T]: Serializable } : T; type ValueOf = T[keyof T]; type Filter, V> = Pick extends V ? K : never }>>; interface NuxtAppConfig { head: Serializable; layoutTransition: boolean | Serializable; pageTransition: boolean | Serializable; viewTransition?: ViewTransitionOptions["enabled"] | ViewTransitionOptions; keepalive: boolean | Serializable; } interface AppConfig { [key: string]: unknown; } interface ViewTransitionOptions { enabled: boolean | "always"; types?: string[]; } type ViewTransitionTypesFn = (to: RouteLocationNormalizedGeneric, from: RouteLocationNormalizedGeneric) => string[]; interface ViewTransitionPageOptions { enabled?: boolean | "always"; types?: string[] | ViewTransitionTypesFn; toTypes?: string[] | ViewTransitionTypesFn; fromTypes?: string[] | ViewTransitionTypesFn; } type HookResult = Promise | void; type TSReference = { types: string; } | { path: string; }; type WatchEvent = "add" | "addDir" | "change" | "unlink" | "unlinkDir"; type VueTSConfig = 0 extends 1 & RawVueCompilerOptions ? TSConfig : TSConfig & { vueCompilerOptions?: RawVueCompilerOptions; }; interface NuxtPage { name?: string; path: string; props?: RouteRecordRaw["props"]; file?: string; meta?: Record; alias?: string[] | string; redirect?: RouteLocationRaw; children?: NuxtPage[]; middleware?: string[] | string; /** * Set the render mode. * * `all` means the page will be rendered isomorphically - with JavaScript both on client and server. * * `server` means pages are automatically rendered with server components, so there will be no JavaScript to render the page in your client bundle. * * `client` means that page will render on the client-side only. */ mode?: "client" | "server" | "all"; /** @internal */ _sync?: boolean; } type NuxtMiddleware = { name: string; path: string; global?: boolean; }; type NuxtLayout = { name: string; file: string; }; /** * @deprecated Use {@link InlinePreset} */ interface ImportPresetWithDeprecation extends InlinePreset {} interface GenerateAppOptions { filter?: (template: ResolvedNuxtTemplate) => boolean; } interface NuxtAnalyzeMeta { name: string; slug: string; startTime: number; endTime: number; analyzeDir: string; buildDir: string; outDir: string; } /** * The listeners to Nuxt build time events */ interface NuxtHooks { /** * Allows extending compatibility checks. * @param compatibility Compatibility object * @param issues Issues to be mapped * @returns Promise */ "kit:compatibility": (compatibility: NuxtCompatibility, issues: NuxtCompatibilityIssues) => HookResult; /** * Called after Nuxt initialization, when the Nuxt instance is ready to work. * @param nuxt The configured Nuxt object * @returns Promise */ "ready": (nuxt: Nuxt) => HookResult; /** * Called when Nuxt instance is gracefully closing. * @param nuxt The configured Nuxt object * @returns Promise */ "close": (nuxt: Nuxt) => HookResult; /** * Called to restart the current Nuxt instance. * @returns Promise */ "restart": (options?: { /** * Try to restart the whole process if supported */ hard?: boolean; }) => HookResult; /** * Called during Nuxt initialization, before installing user modules. * @returns Promise */ "modules:before": () => HookResult; /** * Called during Nuxt initialization, after installing user modules. * @returns Promise */ "modules:done": () => HookResult; /** * Called after resolving the `app` instance. * @param app The resolved `NuxtApp` object * @returns Promise */ "app:resolve": (app: NuxtApp) => HookResult; /** * Called during `NuxtApp` generation, to allow customizing, modifying or adding new files to the build directory (either virtually or to written to `.nuxt`). * @param app The configured `NuxtApp` object * @returns Promise */ "app:templates": (app: NuxtApp) => HookResult; /** * Called after templates are compiled into the [virtual file system](https://nuxt.com/docs/4.x/directory-structure/nuxt) (vfs). * @param app The configured `NuxtApp` object * @returns Promise */ "app:templatesGenerated": (app: NuxtApp, templates: ResolvedNuxtTemplate[], options?: GenerateAppOptions) => HookResult; /** * Called before Nuxt bundle builder. * @returns Promise */ "build:before": () => HookResult; /** * Called after Nuxt bundle builder is complete. * @returns Promise */ "build:done": () => HookResult; /** * Called during the manifest build by Vite and Webpack. This allows customizing the manifest that Nitro will use to render `