@nuxt/schema-nightly 4.3.0-29461891.8f4fbecd → 4.3.0-29466366.fa21bb17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts DELETED
@@ -1,2894 +0,0 @@
1
- import { AppConfig as AppConfig$1, TransitionProps, KeepAliveProps } from 'vue';
2
- import { ViteDevServer, UserConfig, ServerOptions } from 'vite';
3
- import { Options as Options$5 } from '@vitejs/plugin-vue';
4
- import { Options as Options$6 } from '@vitejs/plugin-vue-jsx';
5
- import { SchemaDefinition, Schema } from 'untyped';
6
- export { SchemaDefinition } from 'untyped';
7
- import { NitroOptions, NitroRouteConfig, NitroConfig, Nitro, NitroEventHandler, NitroDevEventHandler, NitroRuntimeConfigApp, NitroRuntimeConfig } from 'nitropack/types';
8
- import { SnakeCase } from 'scule';
9
- import { SourceOptions, DotenvOptions, ResolvedConfig } from 'c12';
10
- import { Server, IncomingMessage, ServerResponse } from 'node:http';
11
- import { AssetURLTagConfig } from '@vue/compiler-sfc';
12
- import { CompilerOptions } from '@vue/compiler-core';
13
- import { SerializableHead, GlobalAttributes, AriaAttributes, DataKeys, RenderSSRHeadOptions } from '@unhead/vue/types';
14
- import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
15
- import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
16
- import { TransformerOptions } from 'unctx/transform';
17
- import { CompatibilityDateSpec } from 'compatx';
18
- import { Ignore, Options } from 'ignore';
19
- import { ChokidarOptions } from 'chokidar';
20
- import { EventHandler, H3CorsOptions } from 'h3';
21
- import { NuxtLinkOptions } from 'nuxt/app';
22
- import { FetchOptions } from 'ofetch';
23
- import { Options as Options$1 } from 'autoprefixer';
24
- import { Options as Options$2 } from 'cssnano';
25
- import { TSConfig } from 'pkg-types';
26
- import { RawVueCompilerOptions } from '@vue/language-core';
27
- import { PluginOptions } from 'mini-css-extract-plugin';
28
- import { LoaderOptions } from 'esbuild-loader';
29
- import { Options as Options$3 } from 'pug';
30
- import { VueLoaderOptions } from 'vue-loader';
31
- import { BasePluginOptions, DefinedDefaultMinimizerAndOptions } from 'css-minimizer-webpack-plugin';
32
- import { Configuration, Compiler, Stats, WebpackError } from 'webpack';
33
- import { ProcessOptions } from 'postcss';
34
- import { Options as Options$4 } from 'webpack-dev-middleware';
35
- import { MiddlewareOptions, ClientOptions } from 'webpack-hot-middleware';
36
- import { TransformOptions as TransformOptions$1 } from 'oxc-transform';
37
- import { TransformOptions } from 'esbuild';
38
- import { RouterOptions as RouterOptions$1, RouterHistory, RouteRecordRaw, RouteLocationRaw } from 'vue-router';
39
- import { Server as Server$1 } from 'node:https';
40
- import { Manifest } from 'vue-bundle-renderer';
41
- import { InlinePreset, Import, Unimport, UnimportOptions } from 'unimport';
42
- import { AsyncLocalStorage } from 'node:async_hooks';
43
- import { Hookable } from 'hookable';
44
- import { Defu } from 'defu';
45
-
46
- interface NuxtCompatibility {
47
- /**
48
- * Required nuxt version in semver format.
49
- * @example `^3.2.0` or `>=3.13.0`.
50
- */
51
- nuxt?: string;
52
- /**
53
- * Mark a builder as incompatible, or require a particular version.
54
- *
55
- * @example
56
- * ```ts
57
- * export default defineNuxtModule({
58
- * meta: {
59
- * name: 'my-module',
60
- * compatibility: {
61
- * builder: {
62
- * // marking as incompatible
63
- * webpack: false,
64
- * // you can require a (semver-compatible) version
65
- * vite: '^5'
66
- * }
67
- * }
68
- * }
69
- * // ...
70
- * })
71
- * ```
72
- */
73
- builder?: Partial<Record<'vite' | 'webpack' | 'rspack' | (string & {}), false | string>>;
74
- }
75
- interface NuxtCompatibilityIssue {
76
- name: string;
77
- message: string;
78
- }
79
- interface NuxtCompatibilityIssues extends Array<NuxtCompatibilityIssue> {
80
- /**
81
- * Return formatted error message.
82
- */
83
- toString(): string;
84
- }
85
-
86
- interface ComponentMeta {
87
- [key: string]: unknown;
88
- }
89
- interface Component {
90
- pascalName: string;
91
- kebabName: string;
92
- export: string;
93
- filePath: string;
94
- shortPath: string;
95
- chunkName: string;
96
- prefetch: boolean;
97
- preload: boolean;
98
- global?: boolean | 'sync';
99
- island?: boolean;
100
- meta?: ComponentMeta;
101
- mode?: 'client' | 'server' | 'all';
102
- /**
103
- * This number allows configuring the behavior of overriding Nuxt components.
104
- * If multiple components are provided with the same name, then higher priority
105
- * components will be used instead of lower priority components.
106
- */
107
- priority?: number;
108
- /**
109
- * Path to component's declaration file
110
- * Used for type generation when different from filePath
111
- * @default filePath
112
- */
113
- declarationPath?: string;
114
- /**
115
- * Allow bypassing client/server transforms for internal Nuxt components like
116
- * ServerPlaceholder and NuxtClientFallback.
117
- *
118
- * @internal
119
- */
120
- _raw?: boolean;
121
- }
122
- interface ScanDir {
123
- /**
124
- * Path (absolute or relative) to the directory containing your components.
125
- * You can use Nuxt aliases (~ or @) to refer to directories inside project or directly use an npm package path similar to require.
126
- */
127
- path: string;
128
- /**
129
- * Accept Pattern that will be run against specified path.
130
- */
131
- pattern?: string | string[];
132
- /**
133
- * Ignore patterns that will be run against specified path.
134
- */
135
- ignore?: string[];
136
- /**
137
- * Prefix all matched components.
138
- */
139
- prefix?: string;
140
- /**
141
- * Prefix component name by its path.
142
- */
143
- pathPrefix?: boolean;
144
- /**
145
- * These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by webpack via its magic comments.
146
- * Learn more on webpack documentation: https://webpack.js.org/api/module-methods/#magic-comments
147
- */
148
- prefetch?: boolean;
149
- /**
150
- * These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by webpack via its magic comments.
151
- * Learn more on webpack documentation: https://webpack.js.org/api/module-methods/#magic-comments
152
- */
153
- preload?: boolean;
154
- /**
155
- * This flag indicates, component should be loaded async (with a separate chunk) regardless of using Lazy prefix or not.
156
- */
157
- isAsync?: boolean;
158
- extendComponent?: (component: Component) => Promise<Component | void> | (Component | void);
159
- /**
160
- * If enabled, registers components to be globally available.
161
- *
162
- */
163
- global?: boolean;
164
- /**
165
- * If enabled, registers components as islands
166
- */
167
- island?: boolean;
168
- }
169
- interface ComponentsDir extends ScanDir {
170
- /**
171
- * Watch specified path for changes, including file additions and file deletions.
172
- */
173
- watch?: boolean;
174
- /**
175
- * Extensions supported by Nuxt builder.
176
- */
177
- extensions?: string[];
178
- /**
179
- * Transpile specified path using build.transpile.
180
- * By default ('auto') it will set transpile: true if node_modules/ is in path.
181
- */
182
- transpile?: 'auto' | boolean;
183
- /**
184
- * This number allows configuring the behavior of overriding Nuxt components.
185
- * It will be inherited by any components within the directory.
186
- *
187
- * If multiple components are provided with the same name, then higher priority
188
- * components will be used instead of lower priority components.
189
- */
190
- priority?: number;
191
- }
192
- interface ComponentsOptions {
193
- dirs: (string | ComponentsDir)[];
194
- /**
195
- * The default value for whether to globally register components.
196
- *
197
- * When components are registered globally, they will still be directly imported where used,
198
- * but they can also be used dynamically, for example `<component :is="`icon-${myIcon}`">`.
199
- *
200
- * This can be overridden by an individual component directory entry.
201
- */
202
- global?: boolean;
203
- /**
204
- * Whether to write metadata to the build directory with information about the components that
205
- * are auto-registered in your app.
206
- */
207
- generateMetadata?: boolean;
208
- loader?: boolean;
209
- transform?: {
210
- exclude?: RegExp[];
211
- include?: RegExp[];
212
- };
213
- }
214
-
215
- interface KeyedFunction {
216
- /**
217
- * The name of the function.
218
- *
219
- * Use 'default' to target a module's default export. In that case, the callable name
220
- * is derived from the filename (camel-cased) for matching during analysis.
221
- */
222
- name: string;
223
- /**
224
- * The path to the file where the function is defined.
225
- * You can use Nuxt aliases (~ or @) to refer to directories inside the project or directly use an npm package path similar to require.
226
- */
227
- source: string;
228
- /**
229
- * The maximum number of arguments the function can accept.
230
- * In the case that the function is called with fewer arguments than this number,
231
- * the compiler will inject an auto-generated key as an additional argument.
232
- *
233
- * The key is unique based on the location of the function being invoked within the file.
234
- *
235
- * @example `{ name: 'useKey', source: '~/composables/useKey', argumentLength: 2 }`
236
- *
237
- * ```ts
238
- * useKey() // will be transformed to: useKey('\$KzLSZ0O59L')
239
- * useKey('first') // will be transformed to: useKey('first', '\$KzLSZ0O59L')
240
- * useKey('first', 'second') // will not be transformed
241
- * ```
242
- */
243
- argumentLength: number;
244
- }
245
-
246
- type RouterOptions = Partial<Omit<RouterOptions$1, 'history' | 'routes'>> & {
247
- history?: (baseURL?: string) => RouterHistory | null | undefined;
248
- routes?: (_routes: RouterOptions$1['routes']) => RouterOptions$1['routes'] | Promise<RouterOptions$1['routes']>;
249
- hashMode?: boolean;
250
- scrollBehaviorType?: 'smooth' | 'auto';
251
- };
252
- type RouterConfig = RouterOptions;
253
- /**
254
- * Only JSON serializable router options are configurable from nuxt config
255
- */
256
- type RouterConfigSerializable = Pick<RouterConfig, 'linkActiveClass' | 'linkExactActiveClass' | 'end' | 'sensitive' | 'strict' | 'hashMode' | 'scrollBehaviorType'>;
257
-
258
- interface ModuleMeta {
259
- /** Module name. */
260
- name?: string;
261
- /** Module version. */
262
- version?: string;
263
- /**
264
- * The configuration key used within `nuxt.config` for this module's options.
265
- * For example, `@nuxtjs/axios` uses `axios`.
266
- */
267
- configKey?: string;
268
- /**
269
- * Constraints for the versions of Nuxt or features this module requires.
270
- */
271
- compatibility?: NuxtCompatibility;
272
- /**
273
- * Fully resolved path used internally by Nuxt. Do not depend on this value.
274
- * @internal
275
- */
276
- rawPath?: string;
277
- /**
278
- * Whether the module has been disabled in the Nuxt configuration.
279
- * @internal
280
- */
281
- disabled?: boolean;
282
- [key: string]: unknown;
283
- }
284
- /** The options received. */
285
- type ModuleOptions = Record<string, any>;
286
- type ModuleSetupInstallResult = {
287
- /**
288
- * Timing information for the initial setup
289
- */
290
- timings?: {
291
- /** Total time took for module setup in ms */
292
- setup?: number;
293
- [key: string]: number | undefined;
294
- };
295
- };
296
- type Awaitable<T> = T | Promise<T>;
297
- type Prettify<T> = {
298
- [K in keyof T]: T[K];
299
- } & {};
300
- type ModuleSetupReturn = Awaitable<false | void | ModuleSetupInstallResult>;
301
- type ResolvedModuleOptions<TOptions extends ModuleOptions, TOptionsDefaults extends Partial<TOptions>> = Prettify<Defu<Partial<TOptions>, [
302
- Partial<TOptions>,
303
- TOptionsDefaults
304
- ]>>;
305
- interface ModuleDependencyMeta<T = Record<string, unknown>> {
306
- version?: string;
307
- overrides?: Partial<T>;
308
- defaults?: Partial<T>;
309
- optional?: boolean;
310
- }
311
- interface ModuleDependencies {
312
- [key: string]: ModuleDependencyMeta<Record<string, unknown>>;
313
- }
314
- /** Module definition passed to 'defineNuxtModule(...)' or 'defineNuxtModule().with(...)'. */
315
- interface ModuleDefinition<TOptions extends ModuleOptions, TOptionsDefaults extends Partial<TOptions>, TWith extends boolean> {
316
- meta?: ModuleMeta;
317
- defaults?: TOptionsDefaults | ((nuxt: Nuxt) => Awaitable<TOptionsDefaults>);
318
- schema?: TOptions;
319
- hooks?: Partial<NuxtHooks>;
320
- moduleDependencies?: ModuleDependencies | ((nuxt: Nuxt) => Awaitable<ModuleDependencies>);
321
- onInstall?: (nuxt: Nuxt) => Awaitable<void>;
322
- onUpgrade?: (nuxt: Nuxt, options: TOptions, previousVersion: string) => Awaitable<void>;
323
- setup?: (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, nuxt: Nuxt) => ModuleSetupReturn;
324
- }
325
- interface NuxtModule<TOptions extends ModuleOptions = ModuleOptions, TOptionsDefaults extends Partial<TOptions> = Partial<TOptions>, TWith extends boolean = false> {
326
- (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, nuxt: Nuxt): ModuleSetupReturn;
327
- getOptions?: (inlineOptions?: Partial<TOptions>, nuxt?: Nuxt) => Promise<TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions>;
328
- getModuleDependencies?: (nuxt: Nuxt) => Awaitable<ModuleDependencies> | undefined;
329
- getMeta?: () => Promise<ModuleMeta>;
330
- onInstall?: (nuxt: Nuxt) => Awaitable<void>;
331
- onUpgrade?: (nuxt: Nuxt, options: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, previousVersion: string) => Awaitable<void>;
332
- }
333
-
334
- interface NuxtDebugContext {
335
- /**
336
- * Module mutation records to the `nuxt` instance.
337
- */
338
- moduleMutationRecords?: NuxtDebugModuleMutationRecord[];
339
- }
340
- interface NuxtDebugModuleMutationRecord {
341
- module: NuxtModule;
342
- keys: (string | symbol)[];
343
- target: 'nuxt.options';
344
- value: any;
345
- method?: string;
346
- timestamp: number;
347
- }
348
- interface NuxtDebugOptions {
349
- /** Debug for Nuxt templates */
350
- templates?: boolean;
351
- /** Debug for modules setup timings */
352
- modules?: boolean;
353
- /** Debug for file watchers */
354
- watchers?: boolean;
355
- /** Debug options for Nitro */
356
- nitro?: NitroOptions['debug'];
357
- /** Debug for production hydration mismatch */
358
- hydration?: boolean;
359
- /** Debug for Vue Router */
360
- router?: boolean;
361
- /** Debug for hooks, can be set to `true` or an object with `server` and `client` keys */
362
- hooks?: boolean | {
363
- server?: boolean;
364
- client?: boolean;
365
- };
366
- }
367
-
368
- interface NuxtPlugin {
369
- /** @deprecated use mode */
370
- ssr?: boolean;
371
- src: string;
372
- mode?: 'all' | 'server' | 'client';
373
- /**
374
- * This allows more granular control over plugin order and should only be used by advanced users.
375
- * Lower numbers run first, and user plugins default to `0`.
376
- *
377
- * 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).
378
- */
379
- order?: number;
380
- /**
381
- * @internal
382
- */
383
- name?: string;
384
- }
385
- type TemplateDefaultOptions = Record<string, any>;
386
- interface NuxtTemplate<Options = TemplateDefaultOptions> {
387
- /** resolved output file path (generated) */
388
- dst?: string;
389
- /** The target filename once the template is copied into the Nuxt buildDir */
390
- filename?: string;
391
- /** An options object that will be accessible within the template via `<% options %>` */
392
- options?: Options;
393
- /** The resolved path to the source file to be template */
394
- src?: string;
395
- /** Provided compile option instead of src */
396
- getContents?: (data: {
397
- nuxt: Nuxt;
398
- app: NuxtApp;
399
- options: Options;
400
- }) => string | Promise<string>;
401
- /** Write to filesystem */
402
- write?: boolean;
403
- /**
404
- * The source path of the template (to try resolving dependencies from).
405
- * @internal
406
- */
407
- _path?: string;
408
- }
409
- interface NuxtServerTemplate {
410
- /** The target filename once the template is copied into the Nuxt buildDir */
411
- filename: string;
412
- getContents: () => string | Promise<string>;
413
- }
414
- interface ResolvedNuxtTemplate<Options = TemplateDefaultOptions> extends NuxtTemplate<Options> {
415
- filename: string;
416
- dst: string;
417
- modified?: boolean;
418
- }
419
- interface NuxtTypeTemplate<Options = TemplateDefaultOptions> extends Omit<NuxtTemplate<Options>, 'write' | 'filename'> {
420
- filename: `${string}.d.ts`;
421
- write?: true;
422
- }
423
- type _TemplatePlugin<Options> = Omit<NuxtPlugin, 'src'> & NuxtTemplate<Options>;
424
- interface NuxtPluginTemplate<Options = TemplateDefaultOptions> extends _TemplatePlugin<Options> {
425
- }
426
- interface NuxtApp {
427
- mainComponent?: string | null;
428
- rootComponent?: string | null;
429
- errorComponent?: string | null;
430
- dir: string;
431
- extensions: string[];
432
- plugins: NuxtPlugin[];
433
- components: Component[];
434
- layouts: Record<string, NuxtLayout>;
435
- middleware: NuxtMiddleware[];
436
- templates: NuxtTemplate[];
437
- configs: string[];
438
- pages?: NuxtPage[];
439
- }
440
- interface Nuxt {
441
- __name: string;
442
- _version: string;
443
- _ignore?: Ignore;
444
- _dependencies?: Set<string>;
445
- _debug?: NuxtDebugContext;
446
- /** Async local storage for current running Nuxt module instance. */
447
- _asyncLocalStorageModule?: AsyncLocalStorage<NuxtModule>;
448
- /**
449
- * Module options functions collected from moduleDependencies.
450
- * @internal
451
- */
452
- _moduleOptionsFunctions?: Map<string | NuxtModule, Array<() => {
453
- defaults?: Record<string, unknown>;
454
- overrides?: Record<string, unknown>;
455
- }>>;
456
- /** The resolved Nuxt configuration. */
457
- options: NuxtOptions;
458
- hooks: Hookable<NuxtHooks>;
459
- hook: Nuxt['hooks']['hook'];
460
- callHook: Nuxt['hooks']['callHook'];
461
- addHooks: Nuxt['hooks']['addHooks'];
462
- runWithContext: <T extends (...args: any[]) => any>(fn: T) => ReturnType<T>;
463
- ready: () => Promise<void>;
464
- close: () => Promise<void>;
465
- /** The production or development server. */
466
- server?: any;
467
- vfs: Record<string, string>;
468
- apps: Record<string, NuxtApp>;
469
- }
470
-
471
- type HookResult = Promise<void> | void;
472
- type TSReference = {
473
- types: string;
474
- } | {
475
- path: string;
476
- };
477
- type WatchEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir';
478
- type VueTSConfig = 0 extends 1 & RawVueCompilerOptions ? TSConfig : TSConfig & {
479
- vueCompilerOptions?: RawVueCompilerOptions;
480
- };
481
- type NuxtPage = {
482
- name?: string;
483
- path: string;
484
- props?: RouteRecordRaw['props'];
485
- file?: string;
486
- meta?: Record<string, any>;
487
- alias?: string[] | string;
488
- redirect?: RouteLocationRaw;
489
- children?: NuxtPage[];
490
- middleware?: string[] | string;
491
- rules?: NitroRouteConfig;
492
- /**
493
- * Set the render mode.
494
- *
495
- * `all` means the page will be rendered isomorphically - with JavaScript both on client and server.
496
- *
497
- * `server` means pages are automatically rendered with server components, so there will be no JavaScript to render the page in your client bundle.
498
- *
499
- * `client` means that page will render on the client-side only.
500
- */
501
- mode?: 'client' | 'server' | 'all';
502
- /** @internal */
503
- _sync?: boolean;
504
- };
505
- type NuxtMiddleware = {
506
- name: string;
507
- path: string;
508
- global?: boolean;
509
- };
510
- type NuxtLayout = {
511
- name: string;
512
- file: string;
513
- };
514
- /**
515
- * @deprecated Use {@link InlinePreset}
516
- */
517
- interface ImportPresetWithDeprecation extends InlinePreset {
518
- }
519
- interface GenerateAppOptions {
520
- filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
521
- }
522
- interface NuxtAnalyzeMeta {
523
- name: string;
524
- slug: string;
525
- startTime: number;
526
- endTime: number;
527
- analyzeDir: string;
528
- buildDir: string;
529
- outDir: string;
530
- }
531
- /**
532
- * The listeners to Nuxt build time events
533
- */
534
- interface NuxtHooks {
535
- /**
536
- * Allows extending compatibility checks.
537
- * @param compatibility Compatibility object
538
- * @param issues Issues to be mapped
539
- * @returns Promise
540
- */
541
- 'kit:compatibility': (compatibility: NuxtCompatibility, issues: NuxtCompatibilityIssues) => HookResult;
542
- /**
543
- * Called after Nuxt initialization, when the Nuxt instance is ready to work.
544
- * @param nuxt The configured Nuxt object
545
- * @returns Promise
546
- */
547
- 'ready': (nuxt: Nuxt) => HookResult;
548
- /**
549
- * Called when Nuxt instance is gracefully closing.
550
- * @param nuxt The configured Nuxt object
551
- * @returns Promise
552
- */
553
- 'close': (nuxt: Nuxt) => HookResult;
554
- /**
555
- * Called to restart the current Nuxt instance.
556
- * @returns Promise
557
- */
558
- 'restart': (options?: {
559
- /**
560
- * Try to restart the whole process if supported
561
- */
562
- hard?: boolean;
563
- }) => HookResult;
564
- /**
565
- * Called during Nuxt initialization, before installing user modules.
566
- * @returns Promise
567
- */
568
- 'modules:before': () => HookResult;
569
- /**
570
- * Called during Nuxt initialization, after installing user modules.
571
- * @returns Promise
572
- */
573
- 'modules:done': () => HookResult;
574
- /**
575
- * Called after resolving the `app` instance.
576
- * @param app The resolved `NuxtApp` object
577
- * @returns Promise
578
- */
579
- 'app:resolve': (app: NuxtApp) => HookResult;
580
- /**
581
- * Called during `NuxtApp` generation, to allow customizing, modifying or adding new files to the build directory (either virtually or to written to `.nuxt`).
582
- * @param app The configured `NuxtApp` object
583
- * @returns Promise
584
- */
585
- 'app:templates': (app: NuxtApp) => HookResult;
586
- /**
587
- * Called after templates are compiled into the [virtual file system](https://nuxt.com/docs/4.x/directory-structure/nuxt) (vfs).
588
- * @param app The configured `NuxtApp` object
589
- * @returns Promise
590
- */
591
- 'app:templatesGenerated': (app: NuxtApp, templates: ResolvedNuxtTemplate[], options?: GenerateAppOptions) => HookResult;
592
- /**
593
- * Called before Nuxt bundle builder.
594
- * @returns Promise
595
- */
596
- 'build:before': () => HookResult;
597
- /**
598
- * Called after Nuxt bundle builder is complete.
599
- * @returns Promise
600
- */
601
- 'build:done': () => HookResult;
602
- /**
603
- * Called during the manifest build by Vite and Webpack. This allows customizing the manifest that Nitro will use to render `<script>` and `<link>` tags in the final HTML.
604
- * @param manifest The manifest object to build
605
- * @returns Promise
606
- */
607
- 'build:manifest': (manifest: Manifest) => HookResult;
608
- /**
609
- * Called when `nuxt analyze` is finished
610
- * @param meta the analyze meta object, mutations will be saved to `meta.json`
611
- * @returns Promise
612
- */
613
- 'build:analyze:done': (meta: NuxtAnalyzeMeta) => HookResult;
614
- /**
615
- * Called before generating the app.
616
- * @param options GenerateAppOptions object
617
- * @returns Promise
618
- */
619
- 'builder:generateApp': (options?: GenerateAppOptions) => HookResult;
620
- /**
621
- * Called at build time in development when the watcher spots a change to a file or directory in the project.
622
- * @param event "add" | "addDir" | "change" | "unlink" | "unlinkDir"
623
- * @param path the path to the watched file
624
- * @returns Promise
625
- */
626
- 'builder:watch': (event: WatchEvent, path: string) => HookResult;
627
- /**
628
- * Called after page routes are scanned from the file system.
629
- * @param pages Array containing scanned pages
630
- * @returns Promise
631
- */
632
- 'pages:extend': (pages: NuxtPage[]) => HookResult;
633
- /**
634
- * Called after page routes have been augmented with scanned metadata.
635
- * @param pages Array containing resolved pages
636
- * @returns Promise
637
- */
638
- 'pages:resolved': (pages: NuxtPage[]) => HookResult;
639
- /**
640
- * Called when resolving `app/router.options` files. It allows modifying the detected router options files
641
- * and adding new ones.
642
- *
643
- * Later items in the array override earlier ones.
644
- *
645
- * Adding a router options file will switch on page-based routing, unless `optional` is set, in which case
646
- * it will only apply when page-based routing is already enabled.
647
- * @param context An object with `files` containing an array of router options files.
648
- * @returns Promise
649
- */
650
- 'pages:routerOptions': (context: {
651
- files: Array<{
652
- path: string;
653
- optional?: boolean;
654
- }>;
655
- }) => HookResult;
656
- /**
657
- * Called when the dev middleware is being registered on the Nitro dev server.
658
- * @param handler the Vite or Webpack event handler
659
- * @returns Promise
660
- */
661
- 'server:devHandler': (handler: EventHandler) => HookResult;
662
- /**
663
- * Called at setup allowing modules to extend sources.
664
- * @param presets Array containing presets objects
665
- * @returns Promise
666
- */
667
- 'imports:sources': (presets: InlinePreset[]) => HookResult;
668
- /**
669
- * Called at setup allowing modules to extend imports.
670
- * @param imports Array containing the imports to extend
671
- * @returns Promise
672
- */
673
- 'imports:extend': (imports: Import[]) => HookResult;
674
- /**
675
- * Called when the [unimport](https://github.com/unjs/unimport) context is created.
676
- * @param context The Unimport context
677
- * @returns Promise
678
- */
679
- 'imports:context': (context: Unimport) => HookResult;
680
- /**
681
- * Allows extending import directories.
682
- * @param dirs Array containing directories as string
683
- * @returns Promise
684
- */
685
- 'imports:dirs': (dirs: string[]) => HookResult;
686
- /**
687
- * Called within `app:resolve` allowing to extend the directories that are scanned for auto-importable components.
688
- * @param dirs The `dirs` option to push new items
689
- * @returns Promise
690
- */
691
- 'components:dirs': (dirs: ComponentsOptions['dirs']) => HookResult;
692
- /**
693
- * Allows extending new components.
694
- * @param components The `components` array to push new items
695
- * @returns Promise
696
- */
697
- 'components:extend': (components: Component[]) => HookResult;
698
- /**
699
- * Called before Nitro writes `.nuxt/tsconfig.server.json`, allowing addition of custom references and declarations.
700
- * @param options Objects containing `references`, `declarations`
701
- * @returns Promise
702
- */
703
- 'nitro:prepare:types': (options: {
704
- references: TSReference[];
705
- declarations: string[];
706
- }) => HookResult;
707
- /**
708
- * Called before initializing Nitro, allowing customization of Nitro's configuration.
709
- * @param nitroConfig The nitro config to be extended
710
- * @returns Promise
711
- */
712
- 'nitro:config': (nitroConfig: NitroConfig) => HookResult;
713
- /**
714
- * Called after Nitro is initialized, which allows registering Nitro hooks and interacting directly with Nitro.
715
- * @param nitro The created nitro object
716
- * @returns Promise
717
- */
718
- 'nitro:init': (nitro: Nitro) => HookResult;
719
- /**
720
- * Called before building the Nitro instance.
721
- * @param nitro The created nitro object
722
- * @returns Promise
723
- */
724
- 'nitro:build:before': (nitro: Nitro) => HookResult;
725
- /**
726
- * Called after copying public assets. Allows modifying public assets before Nitro server is built.
727
- * @param nitro The created nitro object
728
- * @returns Promise
729
- */
730
- 'nitro:build:public-assets': (nitro: Nitro) => HookResult;
731
- /**
732
- * Allows extending the routes to be pre-rendered.
733
- * @param ctx Nuxt context
734
- * @returns Promise
735
- */
736
- 'prerender:routes': (ctx: {
737
- routes: Set<string>;
738
- }) => HookResult;
739
- /**
740
- * Called when an error occurs at build time.
741
- * @param error Error object
742
- * @returns Promise
743
- */
744
- 'build:error': (error: Error) => HookResult;
745
- /**
746
- * Called before @nuxt/cli writes `.nuxt/tsconfig.json` and `.nuxt/nuxt.d.ts`, allowing addition of custom references and declarations in `nuxt.d.ts`, or directly modifying the options in `tsconfig.json`
747
- * @param options Objects containing `references`, `declarations`, `tsConfig`
748
- * @returns Promise
749
- */
750
- 'prepare:types': (options: {
751
- references: TSReference[];
752
- declarations: string[];
753
- tsConfig: VueTSConfig;
754
- nodeTsConfig: TSConfig;
755
- nodeReferences: TSReference[];
756
- sharedTsConfig: TSConfig;
757
- sharedReferences: TSReference[];
758
- }) => HookResult;
759
- /**
760
- * Called when the dev server is loading.
761
- * @param listenerServer The HTTP/HTTPS server object
762
- * @param listener The server's listener object
763
- * @returns Promise
764
- */
765
- 'listen': (listenerServer: Server | Server$1, listener: any) => HookResult;
766
- /**
767
- * Allows extending default schemas.
768
- * @param schemas Schemas to be extend
769
- * @returns void
770
- */
771
- 'schema:extend': (schemas: SchemaDefinition[]) => void;
772
- /**
773
- * Allows extending resolved schema.
774
- * @param schema Schema object
775
- * @returns void
776
- */
777
- 'schema:resolved': (schema: Schema) => void;
778
- /**
779
- * Called before writing the given schema.
780
- * @param schema Schema object
781
- * @returns void
782
- */
783
- 'schema:beforeWrite': (schema: Schema) => void;
784
- /**
785
- * Called after the schema is written.
786
- * @returns void
787
- */
788
- 'schema:written': () => void;
789
- /**
790
- * Allows to extend Vite default context.
791
- * @param viteBuildContext The vite build context object
792
- * @returns Promise
793
- */
794
- 'vite:extend': (viteBuildContext: {
795
- nuxt: Nuxt;
796
- config: ViteConfig;
797
- }) => HookResult;
798
- /**
799
- * Allows to extend Vite default config.
800
- * @param viteInlineConfig The vite inline config object
801
- * @param env Server or client
802
- * @returns Promise
803
- * @deprecated
804
- */
805
- 'vite:extendConfig': (viteInlineConfig: Readonly<ViteConfig>, env: {
806
- isClient: boolean;
807
- isServer: boolean;
808
- }) => HookResult;
809
- /**
810
- * Allows to read the resolved Vite config.
811
- * @param viteInlineConfig The vite inline config object
812
- * @param env Server or client
813
- * @returns Promise
814
- * @deprecated
815
- */
816
- 'vite:configResolved': (viteInlineConfig: Readonly<ViteConfig>, env: {
817
- isClient: boolean;
818
- isServer: boolean;
819
- }) => HookResult;
820
- /**
821
- * Called when the Vite server is created.
822
- * @param viteServer Vite development server
823
- * @param env Server or client
824
- * @returns Promise
825
- */
826
- 'vite:serverCreated': (viteServer: ViteDevServer, env: {
827
- isClient: boolean;
828
- isServer: boolean;
829
- }) => HookResult;
830
- /**
831
- * Called after Vite server is compiled.
832
- * @returns Promise
833
- */
834
- 'vite:compiled': () => HookResult;
835
- /**
836
- * Called before configuring the webpack compiler.
837
- * @param webpackConfigs Configs objects to be pushed to the compiler
838
- * @returns Promise
839
- */
840
- 'webpack:config': (webpackConfigs: Configuration[]) => HookResult;
841
- /**
842
- * Allows to read the resolved webpack config
843
- * @param webpackConfigs Configs objects to be pushed to the compiler
844
- * @returns Promise
845
- */
846
- 'webpack:configResolved': (webpackConfigs: Readonly<Configuration>[]) => HookResult;
847
- /**
848
- * Called right before compilation.
849
- * @param options The options to be added
850
- * @returns Promise
851
- */
852
- 'webpack:compile': (options: {
853
- name: string;
854
- compiler: Compiler;
855
- }) => HookResult;
856
- /**
857
- * Called after resources are loaded.
858
- * @param options The compiler options
859
- * @returns Promise
860
- */
861
- 'webpack:compiled': (options: {
862
- name: string;
863
- compiler: Compiler;
864
- stats: Stats;
865
- }) => HookResult;
866
- /**
867
- * Called on `change` on WebpackBar.
868
- * @param shortPath the short path
869
- * @returns void
870
- */
871
- 'webpack:change': (shortPath: string) => void;
872
- /**
873
- * Called on `done` if has errors on WebpackBar.
874
- * @returns void
875
- */
876
- 'webpack:error': () => void;
877
- /**
878
- * Called on `allDone` on WebpackBar.
879
- * @returns void
880
- */
881
- 'webpack:done': () => void;
882
- /**
883
- * Called on `progress` on WebpackBar.
884
- * @param statesArray The array containing the states on progress
885
- * @returns void
886
- */
887
- 'webpack:progress': (statesArray: any[]) => void;
888
- /**
889
- * Called before configuring the webpack compiler.
890
- * @param webpackConfigs Configs objects to be pushed to the compiler
891
- * @returns Promise
892
- */
893
- 'rspack:config': (webpackConfigs: Configuration[]) => HookResult;
894
- /**
895
- * Allows to read the resolved webpack config
896
- * @param webpackConfigs Configs objects to be pushed to the compiler
897
- * @returns Promise
898
- */
899
- 'rspack:configResolved': (webpackConfigs: Readonly<Configuration>[]) => HookResult;
900
- /**
901
- * Called right before compilation.
902
- * @param options The options to be added
903
- * @returns Promise
904
- */
905
- 'rspack:compile': (options: {
906
- name: string;
907
- compiler: Compiler;
908
- }) => HookResult;
909
- /**
910
- * Called after resources are loaded.
911
- * @param options The compiler options
912
- * @returns Promise
913
- */
914
- 'rspack:compiled': (options: {
915
- name: string;
916
- compiler: Compiler;
917
- stats: Stats;
918
- }) => HookResult;
919
- /**
920
- * Called on `change` on WebpackBar.
921
- * @param shortPath the short path
922
- * @returns void
923
- */
924
- 'rspack:change': (shortPath: string) => void;
925
- /**
926
- * Called on `done` if has errors on WebpackBar.
927
- * @returns void
928
- */
929
- 'rspack:error': () => void;
930
- /**
931
- * Called on `allDone` on WebpackBar.
932
- * @returns void
933
- */
934
- 'rspack:done': () => void;
935
- /**
936
- * Called on `progress` on WebpackBar.
937
- * @param statesArray The array containing the states on progress
938
- * @returns void
939
- */
940
- 'rspack:progress': (statesArray: any[]) => void;
941
- }
942
- type NuxtHookName = keyof NuxtHooks;
943
-
944
- type MetaObjectRaw = SerializableHead;
945
- type MetaObject = MetaObjectRaw;
946
- type AppHeadMetaObject = MetaObjectRaw & {
947
- /**
948
- * The character encoding in which the document is encoded => `<meta charset="<value>" />`
949
- */
950
- charset?: string;
951
- /**
952
- * Configuration of the viewport (the area of the window in which web content can be seen),
953
- * mapped to => `<meta name="viewport" content="<value>" />`
954
- */
955
- viewport?: string;
956
- };
957
- type SerializableHtmlAttributes = GlobalAttributes & AriaAttributes & DataKeys;
958
-
959
- interface ImportsOptions extends UnimportOptions {
960
- /**
961
- * Enable implicit auto import from Vue, Nuxt and module contributed utilities.
962
- * Generate global TypeScript definitions.
963
- */
964
- autoImport?: boolean;
965
- /**
966
- * Directories to scan for auto imports.
967
- * @see https://nuxt.com/docs/4.x/directory-structure/app/composables#how-files-are-scanned
968
- */
969
- dirs?: string[];
970
- /**
971
- * Enabled scan for local directories for auto imports.
972
- * When this is disabled, `dirs` options will be ignored.
973
- */
974
- scan?: boolean;
975
- /**
976
- * Assign auto imported utilities to `globalThis` instead of using built time transformation.
977
- */
978
- global?: boolean;
979
- transform?: {
980
- exclude?: RegExp[];
981
- include?: RegExp[];
982
- };
983
- /**
984
- * Add polyfills for setInterval, requestIdleCallback, and others
985
- */
986
- polyfills?: boolean;
987
- }
988
-
989
- interface ConfigSchema {
990
- /**
991
- * Configure Nuxt component auto-registration.
992
- *
993
- * Any components in the directories configured here can be used throughout your pages, layouts (and other components) without needing to explicitly import them.
994
- *
995
- * @see [`components/` directory documentation](https://nuxt.com/docs/4.x/directory-structure/app/components)
996
- */
997
- components: boolean | ComponentsOptions | ComponentsOptions['dirs'];
998
- /**
999
- * Configure how Nuxt auto-imports composables into your application.
1000
- *
1001
- * @see [Nuxt documentation](https://nuxt.com/docs/4.x/directory-structure/app/composables)
1002
- */
1003
- imports: ImportsOptions;
1004
- /**
1005
- * Whether to use the vue-router integration in Nuxt 3. If you do not provide a value it will be enabled if you have a `pages/` directory in your source folder.
1006
- *
1007
- * Additionally, you can provide a glob pattern or an array of patterns to scan only certain files for pages.
1008
- *
1009
- * @example
1010
- * ```js
1011
- * pages: {
1012
- * pattern: ['**\/*\/*.vue', '!**\/*.spec.*'],
1013
- * }
1014
- * ```
1015
- */
1016
- pages: boolean | {
1017
- enabled?: boolean;
1018
- pattern?: string | string[];
1019
- };
1020
- /**
1021
- * Manually disable nuxt telemetry.
1022
- *
1023
- * @see [Nuxt Telemetry](https://github.com/nuxt/telemetry) for more information.
1024
- */
1025
- telemetry: boolean | Record<string, any>;
1026
- /**
1027
- * Enable Nuxt DevTools for development.
1028
- *
1029
- * Breaking changes for devtools might not reflect on the version of Nuxt.
1030
- *
1031
- * @see [Nuxt DevTools](https://devtools.nuxt.com/) for more information.
1032
- */
1033
- devtools: boolean | {
1034
- enabled: boolean;
1035
- [key: string]: any;
1036
- };
1037
- /**
1038
- * Vue.js config
1039
- */
1040
- vue: {
1041
- transformAssetUrls: AssetURLTagConfig;
1042
- /**
1043
- * Options for the Vue compiler that will be passed at build time.
1044
- *
1045
- * @see [Vue documentation](https://vuejs.org/api/application#app-config-compileroptions)
1046
- */
1047
- compilerOptions: CompilerOptions;
1048
- /**
1049
- * Include Vue compiler in runtime bundle.
1050
- */
1051
- runtimeCompiler: boolean;
1052
- /**
1053
- * Enable reactive destructure for `defineProps`
1054
- */
1055
- propsDestructure: boolean;
1056
- /**
1057
- * It is possible to pass configure the Vue app globally. Only serializable options may be set in your `nuxt.config`. All other options should be set at runtime in a Nuxt plugin.
1058
- *
1059
- * @see [Vue app config documentation](https://vuejs.org/api/application#app-config)
1060
- */
1061
- config: Serializable<AppConfig$1>;
1062
- };
1063
- /**
1064
- * Nuxt App configuration.
1065
- */
1066
- app: {
1067
- /**
1068
- * The base path of your Nuxt application.
1069
- *
1070
- * For example:
1071
- *
1072
- *
1073
- * @example
1074
- * ```ts
1075
- * export default defineNuxtConfig({
1076
- * app: {
1077
- * baseURL: '/prefix/'
1078
- * }
1079
- * })
1080
- * ```
1081
- *
1082
- * This can also be set at runtime by setting the NUXT_APP_BASE_URL environment variable.
1083
- *
1084
- * @example
1085
- * ```bash
1086
- * NUXT_APP_BASE_URL=/prefix/ node .output/server/index.mjs
1087
- * ```
1088
- */
1089
- baseURL: string;
1090
- /**
1091
- * The folder name for the built site assets, relative to `baseURL` (or `cdnURL` if set). This is set at build time and should not be customized at runtime.
1092
- */
1093
- buildAssetsDir: string;
1094
- /**
1095
- * An absolute URL to serve the public folder from (production-only).
1096
- *
1097
- * For example:
1098
- *
1099
- * @example
1100
- * ```ts
1101
- * export default defineNuxtConfig({
1102
- * app: {
1103
- * cdnURL: 'https://mycdn.org/'
1104
- * }
1105
- * })
1106
- * ```
1107
- *
1108
- * This can be set to a different value at runtime by setting the `NUXT_APP_CDN_URL` environment variable.
1109
- *
1110
- * @example
1111
- * ```bash
1112
- * NUXT_APP_CDN_URL=https://mycdn.org/ node .output/server/index.mjs
1113
- * ```
1114
- */
1115
- cdnURL: string;
1116
- /**
1117
- * Set default configuration for `<head>` on every page.
1118
- *
1119
- * @example
1120
- * ```js
1121
- * app: {
1122
- * head: {
1123
- * meta: [
1124
- * // <meta name="viewport" content="width=device-width, initial-scale=1">
1125
- * { name: 'viewport', content: 'width=device-width, initial-scale=1' }
1126
- * ],
1127
- * script: [
1128
- * // <script src="https://myawesome-lib.js"></script>
1129
- * { src: 'https://awesome-lib.js' }
1130
- * ],
1131
- * link: [
1132
- * // <link rel="stylesheet" href="https://myawesome-lib.css">
1133
- * { rel: 'stylesheet', href: 'https://awesome-lib.css' }
1134
- * ],
1135
- * // please note that this is an area that is likely to change
1136
- * style: [
1137
- * // <style>:root { color: red }</style>
1138
- * { textContent: ':root { color: red }' }
1139
- * ],
1140
- * noscript: [
1141
- * // <noscript>JavaScript is required</noscript>
1142
- * { textContent: 'JavaScript is required' }
1143
- * ]
1144
- * }
1145
- * }
1146
- * ```
1147
- */
1148
- head: NuxtAppConfig['head'];
1149
- /**
1150
- * Default values for layout transitions.
1151
- *
1152
- * This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed.
1153
- *
1154
- * @see [Vue Transition docs](https://vuejs.org/api/built-in-components#transition)
1155
- */
1156
- layoutTransition: NuxtAppConfig['layoutTransition'];
1157
- /**
1158
- * Default values for page transitions.
1159
- *
1160
- * This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed.
1161
- *
1162
- * @see [Vue Transition docs](https://vuejs.org/api/built-in-components#transition)
1163
- */
1164
- pageTransition: NuxtAppConfig['pageTransition'];
1165
- /**
1166
- * Default values for view transitions.
1167
- *
1168
- * This only has an effect when **experimental** support for View Transitions is [enabled in your nuxt.config file](https://nuxt.com/docs/4.x/getting-started/transitions#view-transitions-api-experimental).
1169
- * This can be overridden with `definePageMeta` on an individual page.
1170
- *
1171
- * @see [Nuxt View Transition API docs](https://nuxt.com/docs/4.x/getting-started/transitions#view-transitions-api-experimental)
1172
- */
1173
- viewTransition: NuxtAppConfig['viewTransition'];
1174
- /**
1175
- * Default values for KeepAlive configuration between pages.
1176
- *
1177
- * This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed.
1178
- *
1179
- * @see [Vue KeepAlive](https://vuejs.org/api/built-in-components#keepalive)
1180
- */
1181
- keepalive: NuxtAppConfig['keepalive'];
1182
- /**
1183
- * Customize Nuxt root element id.
1184
- *
1185
- * @deprecated Prefer `rootAttrs.id` instead
1186
- */
1187
- rootId: string | false;
1188
- /**
1189
- * Customize Nuxt root element tag.
1190
- */
1191
- rootTag: string;
1192
- /**
1193
- * Customize Nuxt root element id.
1194
- */
1195
- rootAttrs: SerializableHtmlAttributes;
1196
- /**
1197
- * Customize Nuxt Teleport element tag.
1198
- */
1199
- teleportTag: string;
1200
- /**
1201
- * Customize Nuxt Teleport element id.
1202
- *
1203
- * @deprecated Prefer `teleportAttrs.id` instead
1204
- */
1205
- teleportId: string | false;
1206
- /**
1207
- * Customize Nuxt Teleport element attributes.
1208
- */
1209
- teleportAttrs: SerializableHtmlAttributes;
1210
- /**
1211
- * Customize Nuxt SpaLoader element tag.
1212
- */
1213
- spaLoaderTag: string;
1214
- /**
1215
- * Customize Nuxt SPA loading template element attributes.
1216
- */
1217
- spaLoaderAttrs: SerializableHtmlAttributes;
1218
- };
1219
- /**
1220
- * Boolean or a path to an HTML file with the contents of which will be inserted into any HTML page rendered with `ssr: false`.
1221
- *
1222
- * - If it is unset, it will use `~/spa-loading-template.html` file in one of your layers, if it exists. - If it is false, no SPA loading indicator will be loaded. - If true, Nuxt will look for `~/spa-loading-template.html` file in one of your layers, or a
1223
- * default Nuxt image will be used.
1224
- * Some good sources for spinners are [SpinKit](https://github.com/tobiasahlin/SpinKit) or [SVG Spinners](https://icones.js.org/collection/svg-spinners).
1225
- *
1226
- * @example ~/spa-loading-template.html
1227
- * ```html
1228
- * <!-- https://github.com/barelyhuman/snips/blob/dev/pages/css-loader.md -->
1229
- * <div class="loader"></div>
1230
- * <style>
1231
- * .loader {
1232
- * display: block;
1233
- * position: fixed;
1234
- * z-index: 1031;
1235
- * top: 50%;
1236
- * left: 50%;
1237
- * transform: translate(-50%, -50%);
1238
- * width: 18px;
1239
- * height: 18px;
1240
- * box-sizing: border-box;
1241
- * border: solid 2px transparent;
1242
- * border-top-color: #000;
1243
- * border-left-color: #000;
1244
- * border-bottom-color: #efefef;
1245
- * border-right-color: #efefef;
1246
- * border-radius: 50%;
1247
- * -webkit-animation: loader 400ms linear infinite;
1248
- * animation: loader 400ms linear infinite;
1249
- * }
1250
- *
1251
- * @-webkit-keyframes loader {
1252
- * 0% {
1253
- * -webkit-transform: translate(-50%, -50%) rotate(0deg);
1254
- * }
1255
- * 100% {
1256
- * -webkit-transform: translate(-50%, -50%) rotate(360deg);
1257
- * }
1258
- * }
1259
- * @keyframes loader {
1260
- * 0% {
1261
- * transform: translate(-50%, -50%) rotate(0deg);
1262
- * }
1263
- * 100% {
1264
- * transform: translate(-50%, -50%) rotate(360deg);
1265
- * }
1266
- * }
1267
- * </style>
1268
- * ```
1269
- */
1270
- spaLoadingTemplate: string | boolean | undefined | null;
1271
- /**
1272
- * An array of nuxt app plugins.
1273
- *
1274
- * Each plugin can be a string (which can be an absolute or relative path to a file). If it ends with `.client` or `.server` then it will be automatically loaded only in the appropriate context.
1275
- * It can also be an object with `src` and `mode` keys.
1276
- *
1277
- * @note Plugins are also auto-registered from the `~/plugins` directory
1278
- * and these plugins do not need to be listed in `nuxt.config` unless you
1279
- * need to customize their order. All plugins are deduplicated by their src path.
1280
- *
1281
- * @see [`plugins/` directory documentation](https://nuxt.com/docs/4.x/directory-structure/app/plugins)
1282
- *
1283
- * @example
1284
- * ```js
1285
- * plugins: [
1286
- * '~/plugins/foo.client.js', // only in client side
1287
- * '~/plugins/bar.server.js', // only in server side
1288
- * '~/plugins/baz.js', // both client & server
1289
- * { src: '~/plugins/both-sides.js' },
1290
- * { src: '~/plugins/client-only.js', mode: 'client' }, // only on client side
1291
- * { src: '~/plugins/server-only.js', mode: 'server' } // only on server side
1292
- * ]
1293
- * ```
1294
- */
1295
- plugins: (NuxtPlugin | string)[];
1296
- /**
1297
- * You can define the CSS files/modules/libraries you want to set globally (included in every page).
1298
- *
1299
- * Nuxt will automatically guess the file type by its extension and use the appropriate pre-processor. You will still need to install the required loader if you need to use them.
1300
- *
1301
- * @example
1302
- * ```js
1303
- * css: [
1304
- * // Load a Node.js module directly (here it's a Sass file).
1305
- * 'bulma',
1306
- * // CSS file in the project
1307
- * '~/assets/css/main.css',
1308
- * // SCSS file in the project
1309
- * '~/assets/css/main.scss'
1310
- * ]
1311
- * ```
1312
- */
1313
- css: string[];
1314
- /**
1315
- * An object that allows us to configure the `unhead` nuxt module.
1316
- */
1317
- unhead: {
1318
- /**
1319
- * Enable the legacy compatibility mode for `unhead` module. This applies the following changes: - Disables Capo.js sorting - Adds the `DeprecationsPlugin`: supports `hid`, `vmid`, `children`, `body` - Adds the `PromisesPlugin`: supports promises as input
1320
- *
1321
- *
1322
- * @see [`unhead` migration documentation](https://unhead.unjs.io/docs/typescript/head/guides/get-started/migration)
1323
- *
1324
- * @example
1325
- * ```ts
1326
- * export default defineNuxtConfig({
1327
- * unhead: {
1328
- * legacy: true
1329
- * })
1330
- * ```
1331
- */
1332
- legacy: boolean;
1333
- /**
1334
- * An object that will be passed to `renderSSRHead` to customize the output.
1335
- *
1336
- * @example
1337
- * ```ts
1338
- * export default defineNuxtConfig({
1339
- * unhead: {
1340
- * renderSSRHeadOptions: {
1341
- * omitLineBreaks: true
1342
- * }
1343
- * })
1344
- * ```
1345
- */
1346
- renderSSRHeadOptions: RenderSSRHeadOptions;
1347
- };
1348
- /**
1349
- * The builder to use for bundling the Vue part of your application.
1350
- *
1351
- */
1352
- builder: 'vite' | 'webpack' | 'rspack' | {
1353
- bundle: (nuxt: Nuxt) => Promise<void>;
1354
- };
1355
- /**
1356
- * Configures whether and how sourcemaps are generated for server and/or client bundles.
1357
- *
1358
- * If set to a single boolean, that value applies to both server and client. Additionally, the `'hidden'` option is also available for both server and client.
1359
- * Available options for both client and server: - `true`: Generates sourcemaps and includes source references in the final bundle. - `false`: Does not generate any sourcemaps. - `'hidden'`: Generates sourcemaps but does not include references in the final bundle.
1360
- */
1361
- sourcemap: boolean | {
1362
- server?: boolean | 'hidden';
1363
- client?: boolean | 'hidden';
1364
- };
1365
- /**
1366
- * Log level when building logs.
1367
- *
1368
- * Defaults to 'silent' when running in CI or when a TTY is not available. This option is then used as 'silent' in Vite and 'none' in Webpack
1369
- *
1370
- */
1371
- logLevel: 'silent' | 'info' | 'verbose';
1372
- /**
1373
- * Shared build configuration.
1374
- */
1375
- build: {
1376
- /**
1377
- * If you want to transpile specific dependencies with Babel, you can add them here. Each item in transpile can be a package name, a function, a string or regex object matching the dependency's file name.
1378
- *
1379
- * You can also use a function to conditionally transpile. The function will receive an object ({ isDev, isServer, isClient, isModern, isLegacy }).
1380
- *
1381
- * @example
1382
- * ```js
1383
- * transpile: [({ isLegacy }) => isLegacy && 'ky']
1384
- * ```
1385
- */
1386
- transpile: Array<string | RegExp | ((ctx: {
1387
- isClient?: boolean;
1388
- isServer?: boolean;
1389
- isDev: boolean;
1390
- }) => string | RegExp | false)>;
1391
- /**
1392
- * It is recommended to use `addTemplate` from `@nuxt/kit` instead of this option.
1393
- *
1394
- * @example
1395
- * ```js
1396
- * templates: [
1397
- * {
1398
- * src: '~/modules/support/plugin.js', // `src` can be absolute or relative
1399
- * dst: 'support.js', // `dst` is relative to project `.nuxt` dir
1400
- * }
1401
- * ]
1402
- * ```
1403
- */
1404
- templates: NuxtTemplate<any>[];
1405
- /**
1406
- * Nuxt allows visualizing your bundles and how to optimize them.
1407
- *
1408
- * Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options).
1409
- *
1410
- * @example
1411
- * ```js
1412
- * analyze: {
1413
- * analyzerMode: 'static'
1414
- * }
1415
- * ```
1416
- */
1417
- analyze: boolean | {
1418
- enabled?: boolean;
1419
- } & ((0 extends 1 & BundleAnalyzerPlugin.Options ? Record<string, unknown> : BundleAnalyzerPlugin.Options) | PluginVisualizerOptions);
1420
- };
1421
- /**
1422
- * Build time optimization configuration.
1423
- */
1424
- optimization: {
1425
- /**
1426
- * Functions to inject a key for.
1427
- *
1428
- * As long as the number of arguments passed to the function is lower than `argumentLength`, an additional magic string will be injected that can be used to deduplicate requests between server and client. You will need to take steps to handle this additional key.
1429
- * The key will be unique based on the location of the function being invoked within the file.
1430
- *
1431
- */
1432
- keyedComposables: KeyedFunction[];
1433
- /**
1434
- * Tree shake code from specific builds.
1435
- */
1436
- treeShake: {
1437
- /**
1438
- * Tree shake composables from the server or client builds.
1439
- *
1440
- *
1441
- * @example
1442
- * ```js
1443
- * treeShake: { client: { myPackage: ['useServerOnlyComposable'] } }
1444
- * ```
1445
- */
1446
- composables: {
1447
- server: Record<string, string[]>;
1448
- client: Record<string, string[]>;
1449
- };
1450
- };
1451
- /**
1452
- * Options passed directly to the transformer from `unctx` that preserves async context after `await`.
1453
- */
1454
- asyncTransforms: TransformerOptions;
1455
- };
1456
- /**
1457
- * Extend project from multiple local or remote sources.
1458
- *
1459
- * Value should be either a string or array of strings pointing to source directories or config path relative to current config.
1460
- * You can use `github:`, `gh:` `gitlab:` or `bitbucket:`
1461
- *
1462
- * @see [`c12` docs on extending config layers](https://github.com/unjs/c12#extending-config-layer-from-remote-sources)
1463
- *
1464
- * @see [`giget` documentation](https://github.com/unjs/giget)
1465
- */
1466
- extends: string | [string, SourceOptions?] | (string | [string, SourceOptions?])[];
1467
- /**
1468
- * Specify a compatibility date for your app.
1469
- *
1470
- * This is used to control the behavior of presets in Nitro, Nuxt Image and other modules that may change behavior without a major version bump.
1471
- * We plan to improve the tooling around this feature in the future.
1472
- */
1473
- compatibilityDate: CompatibilityDateSpec;
1474
- /**
1475
- * Extend project from a local or remote source.
1476
- *
1477
- * Value should be a string pointing to source directory or config path relative to current config.
1478
- * You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository.
1479
- */
1480
- theme: string;
1481
- /**
1482
- * Define the root directory of your application.
1483
- *
1484
- * This property can be overwritten (for example, running `nuxt ./my-app/` will set the `rootDir` to the absolute path of `./my-app/` from the current/working directory.
1485
- * It is normally not needed to configure this option.
1486
- *
1487
- */
1488
- rootDir: string;
1489
- /**
1490
- * Define the workspace directory of your application.
1491
- *
1492
- * Often this is used when in a monorepo setup. Nuxt will attempt to detect your workspace directory automatically, but you can override it here.
1493
- * It is normally not needed to configure this option.
1494
- *
1495
- */
1496
- workspaceDir: string;
1497
- /**
1498
- * Define the source directory of your Nuxt application.
1499
- *
1500
- * If a relative path is specified, it will be relative to the `rootDir`.
1501
- *
1502
- *
1503
- * @example
1504
- * ```js
1505
- * export default {
1506
- * srcDir: 'app/'
1507
- * }
1508
- * ```
1509
- * This expects the following folder structure:
1510
- * ```bash
1511
- * -| app/
1512
- * ---| assets/
1513
- * ---| components/
1514
- * ---| layouts/
1515
- * ---| middleware/
1516
- * ---| pages/
1517
- * ---| plugins/
1518
- * ---| app.config.ts
1519
- * ---| app.vue
1520
- * ---| error.vue
1521
- * -| server/
1522
- * -| public/
1523
- * -| modules/
1524
- * -| nuxt.config.js
1525
- * -| package.json
1526
- * ```
1527
- */
1528
- srcDir: string;
1529
- /**
1530
- * Define the server directory of your Nuxt application, where Nitro routes, middleware and plugins are kept.
1531
- *
1532
- * If a relative path is specified, it will be relative to your `rootDir`.
1533
- *
1534
- */
1535
- serverDir: string;
1536
- /**
1537
- * Define the directory where your built Nuxt files will be placed.
1538
- *
1539
- * Many tools assume that `.nuxt` is a hidden directory (because it starts with a `.`). If that is a problem, you can use this option to prevent that.
1540
- *
1541
- *
1542
- * @example
1543
- * ```js
1544
- * export default {
1545
- * buildDir: 'nuxt-build'
1546
- * }
1547
- * ```
1548
- */
1549
- buildDir: string;
1550
- /**
1551
- * For multi-app projects, the unique id of the Nuxt application.
1552
- *
1553
- * Defaults to `nuxt-app`.
1554
- *
1555
- */
1556
- appId: string;
1557
- /**
1558
- * A unique identifier matching the build. This may contain the hash of the current state of the project.
1559
- *
1560
- */
1561
- buildId: string;
1562
- /**
1563
- * Used to set the modules directories for path resolving (for example, webpack's `resolveLoading`, `nodeExternals` and `postcss`).
1564
- *
1565
- * The configuration path is relative to `options.rootDir` (default is current working directory).
1566
- * Setting this field may be necessary if your project is organized as a yarn workspace-styled mono-repository.
1567
- *
1568
- *
1569
- * @example
1570
- * ```js
1571
- * export default {
1572
- * modulesDir: ['../../node_modules']
1573
- * }
1574
- * ```
1575
- */
1576
- modulesDir: Array<string>;
1577
- /**
1578
- * The directory where Nuxt will store the generated files when running `nuxt analyze`.
1579
- *
1580
- * If a relative path is specified, it will be relative to your `rootDir`.
1581
- *
1582
- */
1583
- analyzeDir: string;
1584
- /**
1585
- * Whether Nuxt is running in development mode.
1586
- *
1587
- * Normally, you should not need to set this.
1588
- *
1589
- */
1590
- dev: boolean;
1591
- /**
1592
- * Whether your app is being unit tested.
1593
- *
1594
- */
1595
- test: boolean;
1596
- /**
1597
- * Set to `true` to enable debug mode.
1598
- *
1599
- * At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser.
1600
- * You can also set this to an object to enable specific debug options.
1601
- *
1602
- */
1603
- debug: boolean | (NuxtDebugOptions) | undefined;
1604
- /**
1605
- * Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false` generated pages will have no content.
1606
- *
1607
- */
1608
- ssr: boolean;
1609
- /**
1610
- * Modules are Nuxt extensions which can extend its core functionality and add endless integrations.
1611
- *
1612
- * Each module is either a string (which can refer to a package, or be a path to a file), a tuple with the module as first string and the options as a second object, or an inline module function.
1613
- * Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `srcDir` if `~` alias is used.
1614
- *
1615
- * @note Modules are executed sequentially so the order is important. First, the modules defined in `nuxt.config.ts` are loaded. Then, modules found in the `modules/`
1616
- * directory are executed, and they load in alphabetical order.
1617
- *
1618
- * @example
1619
- * ```js
1620
- * modules: [
1621
- * // Using package name
1622
- * '@nuxtjs/axios',
1623
- * // Relative to your project srcDir
1624
- * '~/modules/awesome.js',
1625
- * // Providing options
1626
- * ['@nuxtjs/google-analytics', { ua: 'X1234567' }],
1627
- * // Inline definition
1628
- * function () {}
1629
- * ]
1630
- * ```
1631
- */
1632
- modules: (NuxtModule<any> | string | [NuxtModule | string, Record<string, any>] | undefined | null | false)[];
1633
- /**
1634
- * Customize default directory structure used by Nuxt.
1635
- *
1636
- * It is better to stick with defaults unless needed.
1637
- */
1638
- dir: {
1639
- app: string;
1640
- /**
1641
- * The assets directory (aliased as `~assets` in your build).
1642
- */
1643
- assets: string;
1644
- /**
1645
- * The layouts directory, each file of which will be auto-registered as a Nuxt layout.
1646
- */
1647
- layouts: string;
1648
- /**
1649
- * The middleware directory, each file of which will be auto-registered as a Nuxt middleware.
1650
- */
1651
- middleware: string;
1652
- /**
1653
- * The modules directory, each file in which will be auto-registered as a Nuxt module.
1654
- */
1655
- modules: string;
1656
- /**
1657
- * The directory which will be processed to auto-generate your application page routes.
1658
- */
1659
- pages: string;
1660
- /**
1661
- * The plugins directory, each file of which will be auto-registered as a Nuxt plugin.
1662
- */
1663
- plugins: string;
1664
- /**
1665
- * The shared directory. This directory is shared between the app and the server.
1666
- */
1667
- shared: string;
1668
- /**
1669
- * The directory containing your static files, which will be directly accessible via the Nuxt server and copied across into your `dist` folder when your app is generated.
1670
- */
1671
- public: string;
1672
- };
1673
- /**
1674
- * The extensions that should be resolved by the Nuxt resolver.
1675
- *
1676
- */
1677
- extensions: Array<string>;
1678
- /**
1679
- * You can improve your DX by defining additional aliases to access custom directories within your JavaScript and CSS.
1680
- *
1681
- * @note Within a webpack context (image sources, CSS - but not JavaScript) you _must_ access
1682
- * your alias by prefixing it with `~`.
1683
- *
1684
- * @note These aliases will be automatically added to the generated `.nuxt/tsconfig.json` so you can get full
1685
- * type support and path auto-complete. In case you need to extend options provided by `./.nuxt/tsconfig.json`
1686
- * further, make sure to add them here or within the `typescript.tsConfig` property in `nuxt.config`.
1687
- *
1688
- * @example
1689
- * ```js
1690
- * export default {
1691
- * alias: {
1692
- * 'images': fileURLToPath(new URL('./assets/images', import.meta.url)),
1693
- * 'style': fileURLToPath(new URL('./assets/style', import.meta.url)),
1694
- * 'data': fileURLToPath(new URL('./assets/other/data', import.meta.url))
1695
- * }
1696
- * }
1697
- * ```
1698
- *
1699
- * ```html
1700
- * <template>
1701
- * <img src="~images/main-bg.jpg">
1702
- * </template>
1703
- *
1704
- * <script>
1705
- * import data from 'data/test.json'
1706
- * </script>
1707
- *
1708
- * <style>
1709
- * // Uncomment the below
1710
- * //@import '~style/variables.scss';
1711
- * //@import '~style/utils.scss';
1712
- * //@import '~style/base.scss';
1713
- * body {
1714
- * background-image: url('~images/main-bg.jpg');
1715
- * }
1716
- * </style>
1717
- * ```
1718
- */
1719
- alias: Record<string, string>;
1720
- /**
1721
- * Pass options directly to `node-ignore` (which is used by Nuxt to ignore files).
1722
- *
1723
- * @see [node-ignore](https://github.com/kaelzhang/node-ignore)
1724
- *
1725
- * @example
1726
- * ```js
1727
- * ignoreOptions: {
1728
- * ignorecase: false
1729
- * }
1730
- * ```
1731
- */
1732
- ignoreOptions: Options;
1733
- /**
1734
- * Any file in `pages/`, `layouts/`, `middleware/`, and `public/` directories will be ignored during the build process if its filename starts with the prefix specified by `ignorePrefix`. This is intended to prevent certain files from being processed or served in the built application. By default, the `ignorePrefix` is set to '-', ignoring any files starting with '-'.
1735
- *
1736
- */
1737
- ignorePrefix: string;
1738
- /**
1739
- * More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building.
1740
- *
1741
- */
1742
- ignore: Array<string>;
1743
- /**
1744
- * The watch property lets you define patterns that will restart the Nuxt dev server when changed.
1745
- *
1746
- * It is an array of strings or regular expressions. Strings should be either absolute paths or relative to the `srcDir` (and the `srcDir` of any layers). Regular expressions will be matched against the path relative to the project `srcDir` (and the `srcDir` of any layers).
1747
- */
1748
- watch: Array<string | RegExp>;
1749
- /**
1750
- * The watchers property lets you overwrite watchers configuration in your `nuxt.config`.
1751
- */
1752
- watchers: {
1753
- /**
1754
- * An array of event types, which, when received, will cause the watcher to restart.
1755
- */
1756
- rewatchOnRawEvents: string[];
1757
- /**
1758
- * `watchOptions` to pass directly to webpack.
1759
- *
1760
- * @see [webpack@4 watch options](https://v4.webpack.js.org/configuration/watch/#watchoptions).
1761
- */
1762
- webpack: {
1763
- aggregateTimeout: number;
1764
- };
1765
- /**
1766
- * Options to pass directly to `chokidar`.
1767
- *
1768
- * @see [chokidar](https://github.com/paulmillr/chokidar)
1769
- */
1770
- chokidar: ChokidarOptions;
1771
- };
1772
- /**
1773
- * Hooks are listeners to Nuxt events that are typically used in modules, but are also available in `nuxt.config`.
1774
- *
1775
- * Internally, hooks follow a naming pattern using colons (e.g., build:done).
1776
- * For ease of configuration, you can also structure them as an hierarchical object in `nuxt.config` (as below).
1777
- *
1778
- * @example
1779
- * ```js
1780
- * import fs from 'node:fs'
1781
- * import path from 'node:path'
1782
- * export default {
1783
- * hooks: {
1784
- * build: {
1785
- * done(builder) {
1786
- * const extraFilePath = path.join(
1787
- * builder.nuxt.options.buildDir,
1788
- * 'extra-file'
1789
- * )
1790
- * fs.writeFileSync(extraFilePath, 'Something extra')
1791
- * }
1792
- * }
1793
- * }
1794
- * }
1795
- * ```
1796
- */
1797
- hooks: NuxtHooks;
1798
- /**
1799
- * Runtime config allows passing dynamic config and environment variables to the Nuxt app context.
1800
- *
1801
- * The value of this object is accessible from server only using `useRuntimeConfig`.
1802
- * It mainly should hold _private_ configuration which is not exposed on the frontend. This could include a reference to your API secret tokens.
1803
- * Anything under `public` and `app` will be exposed to the frontend as well.
1804
- * Values are automatically replaced by matching env variables at runtime, e.g. setting an environment variable `NUXT_API_KEY=my-api-key NUXT_PUBLIC_BASE_URL=/foo/` would overwrite the two values in the example below.
1805
- *
1806
- * @example
1807
- * ```js
1808
- * export default {
1809
- * runtimeConfig: {
1810
- * apiKey: '', // Default to an empty string, automatically set at runtime using process.env.NUXT_API_KEY
1811
- * public: {
1812
- * baseURL: '' // Exposed to the frontend as well.
1813
- * }
1814
- * }
1815
- * }
1816
- * ```
1817
- */
1818
- runtimeConfig: RuntimeConfig;
1819
- /**
1820
- * Additional app configuration
1821
- *
1822
- * For programmatic usage and type support, you can directly provide app config with this option. It will be merged with `app.config` file as default value.
1823
- */
1824
- appConfig: AppConfig;
1825
- devServer: {
1826
- /**
1827
- * Whether to enable HTTPS.
1828
- *
1829
- *
1830
- * @example
1831
- * ```ts
1832
- * export default defineNuxtConfig({
1833
- * devServer: {
1834
- * https: {
1835
- * key: './server.key',
1836
- * cert: './server.crt'
1837
- * }
1838
- * }
1839
- * })
1840
- * ```
1841
- */
1842
- https: boolean | {
1843
- key: string;
1844
- cert: string;
1845
- } | {
1846
- pfx: string;
1847
- passphrase: string;
1848
- };
1849
- /**
1850
- * Dev server listening port
1851
- */
1852
- port: number;
1853
- /**
1854
- * Dev server listening host
1855
- */
1856
- host: string | undefined;
1857
- /**
1858
- * Listening dev server URL.
1859
- *
1860
- * This should not be set directly as it will always be overridden by the dev server with the full URL (for module and internal use).
1861
- */
1862
- url: string;
1863
- /**
1864
- * Template to show a loading screen
1865
- */
1866
- loadingTemplate: (data: {
1867
- loading?: string;
1868
- }) => string;
1869
- /**
1870
- * Set CORS options for the dev server
1871
- */
1872
- cors: H3CorsOptions;
1873
- };
1874
- /**
1875
- * `future` is for early opting-in to new features that will become default in a future (possibly major) version of the framework.
1876
- */
1877
- future: {
1878
- /**
1879
- * Enable early access to future features or flags.
1880
- *
1881
- */
1882
- compatibilityVersion: 4 | 5;
1883
- /**
1884
- * This enables early access to the experimental multi-app support.
1885
- *
1886
- * @see [Nuxt Issue #21635](https://github.com/nuxt/nuxt/issues/21635)
1887
- */
1888
- multiApp: boolean;
1889
- /**
1890
- * This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting for frameworks like Nuxt and Vite.
1891
- *
1892
- * It improves type support when using modern libraries with `exports`.
1893
- * You can set it to false to use the legacy 'Node' mode, which is the default for TypeScript.
1894
- *
1895
- * @see [TypeScript PR implementing `bundler` module resolution](https://github.com/microsoft/TypeScript/pull/51669)
1896
- */
1897
- typescriptBundlerResolution: boolean;
1898
- };
1899
- /**
1900
- * Some features of Nuxt are available on an opt-in basis, or can be disabled based on your needs.
1901
- */
1902
- features: {
1903
- /**
1904
- * Inline styles when rendering HTML (currently vite only).
1905
- *
1906
- * You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component.
1907
- */
1908
- inlineStyles: boolean | ((id?: string) => boolean);
1909
- /**
1910
- * Stream server logs to the client as you are developing. These logs can be handled in the `dev:ssr-logs` hook.
1911
- *
1912
- * If set to `silent`, the logs will not be printed to the browser console.
1913
- */
1914
- devLogs: boolean | 'silent';
1915
- /**
1916
- * Turn off rendering of Nuxt scripts and JS resource hints. You can also disable scripts more granularly within `routeRules`.
1917
- *
1918
- * If set to 'production' or `true`, JS will be disabled in production mode only.
1919
- */
1920
- noScripts: 'production' | 'all' | boolean;
1921
- };
1922
- experimental: {
1923
- /**
1924
- * Enable to use experimental decorators in Nuxt and Nitro.
1925
- *
1926
- *
1927
- * @see https://github.com/tc39/proposal-decorators
1928
- */
1929
- decorators: boolean;
1930
- /**
1931
- * Set to true to generate an async entry point for the Vue bundle (for module federation support).
1932
- */
1933
- asyncEntry: boolean;
1934
- /**
1935
- * Externalize `vue`, `@vue/*` and `vue-router` when building.
1936
- *
1937
- * @see [Nuxt Issue #13632](https://github.com/nuxt/nuxt/issues/13632)
1938
- */
1939
- externalVue: boolean;
1940
- /**
1941
- * Enable accessing `appConfig` from server routes.
1942
- *
1943
- * @deprecated This option is not recommended.
1944
- */
1945
- serverAppConfig: boolean;
1946
- /**
1947
- * Emit `app:chunkError` hook when there is an error loading vite/webpack chunks.
1948
- *
1949
- * By default, Nuxt will also perform a reload of the new route when a chunk fails to load when navigating to a new route (`automatic`).
1950
- * Setting `automatic-immediate` will lead Nuxt to perform a reload of the current route right when a chunk fails to load (instead of waiting for navigation).
1951
- * You can disable automatic handling by setting this to `false`, or handle chunk errors manually by setting it to `manual`.
1952
- *
1953
- * @see [Nuxt PR #19038](https://github.com/nuxt/nuxt/pull/19038)
1954
- */
1955
- emitRouteChunkError: false | 'manual' | 'automatic' | 'automatic-immediate';
1956
- /**
1957
- * By default the route object returned by the auto-imported `useRoute()` composable is kept in sync with the current page in view in `<NuxtPage>`. This is not true for `vue-router`'s exported `useRoute` or for the default `$route` object available in your Vue templates.
1958
- *
1959
- * By enabling this option a mixin will be injected to keep the `$route` template object in sync with Nuxt's managed `useRoute()`.
1960
- */
1961
- templateRouteInjection: boolean;
1962
- /**
1963
- * Whether to restore Nuxt app state from `sessionStorage` when reloading the page after a chunk error or manual `reloadNuxtApp()` call.
1964
- *
1965
- * To avoid hydration errors, it will be applied only after the Vue app has been mounted, meaning there may be a flicker on initial load.
1966
- * Consider carefully before enabling this as it can cause unexpected behavior, and consider providing explicit keys to `useState` as auto-generated keys may not match across builds.
1967
- */
1968
- restoreState: boolean;
1969
- /**
1970
- * Render JSON payloads with support for revivifying complex types.
1971
- */
1972
- renderJsonPayloads: boolean;
1973
- /**
1974
- * Disable vue server renderer endpoint within nitro.
1975
- */
1976
- noVueServer: boolean;
1977
- /**
1978
- * When this option is enabled (by default) payload of pages that are prerendered are extracted
1979
- */
1980
- payloadExtraction: boolean | undefined;
1981
- /**
1982
- * Whether to enable the experimental `<NuxtClientFallback>` component for rendering content on the client if there's an error in SSR.
1983
- */
1984
- clientFallback: boolean;
1985
- /**
1986
- * Enable cross-origin prefetch using the Speculation Rules API.
1987
- */
1988
- crossOriginPrefetch: boolean;
1989
- /**
1990
- * Enable View Transition API integration with client-side router.
1991
- *
1992
- * @see [View Transitions API](https://developer.chrome.com/docs/web-platform/view-transitions)
1993
- */
1994
- viewTransition: boolean | 'always';
1995
- /**
1996
- * Write early hints when using node server.
1997
- *
1998
- * @note nginx does not support 103 Early hints in the current version.
1999
- */
2000
- writeEarlyHints: boolean;
2001
- /**
2002
- * Experimental component islands support with `<NuxtIsland>` and `.island.vue` files.
2003
- *
2004
- * By default it is set to 'auto', which means it will be enabled only when there are islands, server components or server pages in your app.
2005
- */
2006
- componentIslands: true | 'auto' | 'local' | 'local+remote' | Partial<{
2007
- remoteIsland: boolean;
2008
- selectiveClient: boolean | 'deep';
2009
- }> | false;
2010
- /**
2011
- * Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories.
2012
- */
2013
- localLayerAliases: boolean;
2014
- /**
2015
- * Enable the new experimental typed router using [unplugin-vue-router](https://github.com/posva/unplugin-vue-router).
2016
- */
2017
- typedPages: boolean;
2018
- /**
2019
- * Use app manifests to respect route rules on client-side.
2020
- */
2021
- appManifest: boolean;
2022
- /**
2023
- * Set the time interval (in ms) to check for new builds. Disabled when `experimental.appManifest` is `false`.
2024
- *
2025
- * Set to `false` to disable.
2026
- */
2027
- checkOutdatedBuildInterval: number | false;
2028
- /**
2029
- * Set an alternative watcher that will be used as the watching service for Nuxt.
2030
- *
2031
- * Nuxt uses 'chokidar-granular' if your source directory is the same as your root directory . This will ignore top-level directories (like `node_modules` and `.git`) that are excluded from watching.
2032
- * You can set this instead to `parcel` to use `@parcel/watcher`, which may improve performance in large projects or on Windows platforms.
2033
- * You can also set this to `chokidar` to watch all files in your source directory.
2034
- *
2035
- * @see [chokidar](https://github.com/paulmillr/chokidar)
2036
- *
2037
- * @see [@parcel/watcher](https://github.com/parcel-bundler/watcher)
2038
- */
2039
- watcher: 'chokidar' | 'parcel' | 'chokidar-granular';
2040
- /**
2041
- * Enable native async context to be accessible for nested composables
2042
- *
2043
- * @see [Nuxt PR #20918](https://github.com/nuxt/nuxt/pull/20918)
2044
- */
2045
- asyncContext: boolean;
2046
- /**
2047
- * Use new experimental head optimisations:
2048
- *
2049
- * - Add the capo.js head plugin in order to render tags in of the head in a more performant way. - Uses the hash hydration plugin to reduce initial hydration
2050
- *
2051
- * @see [Nuxt Discussion #22632](https://github.com/nuxt/nuxt/discussions/22632)
2052
- */
2053
- headNext: boolean;
2054
- /**
2055
- * Allow defining `routeRules` directly within your `~/pages` directory using `defineRouteRules`.
2056
- *
2057
- * Rules are converted (based on the path) and applied for server requests. For example, a rule defined in `~/pages/foo/bar.vue` will be applied to `/foo/bar` requests. A rule in `~/pages/foo/[id].vue` will be applied to `/foo/**` requests.
2058
- * For more control, such as if you are using a custom `path` or `alias` set in the page's `definePageMeta`, you should set `routeRules` directly within your `nuxt.config`.
2059
- */
2060
- inlineRouteRules: boolean;
2061
- /**
2062
- * Allow exposing some route metadata defined in `definePageMeta` at build-time to modules (alias, name, path, redirect, props, middleware).
2063
- *
2064
- * This only works with static or strings/arrays rather than variables or conditional assignment.
2065
- *
2066
- * @see [Nuxt Issues #24770](https://github.com/nuxt/nuxt/issues/24770)
2067
- */
2068
- scanPageMeta: boolean | 'after-resolve';
2069
- /**
2070
- * Configure additional keys to extract from the page metadata when using `scanPageMeta`.
2071
- *
2072
- * This allows modules to access additional metadata from the page metadata. It's recommended to augment the NuxtPage types with your keys.
2073
- */
2074
- extraPageMetaExtractionKeys: string[];
2075
- /**
2076
- * Automatically share payload _data_ between pages that are prerendered. This can result in a significant performance improvement when prerendering sites that use `useAsyncData` or `useFetch` and fetch the same data in different pages.
2077
- *
2078
- * It is particularly important when enabling this feature to make sure that any unique key of your data is always resolvable to the same data. For example, if you are using `useAsyncData` to fetch data related to a particular page, you should provide a key that uniquely matches that data. (`useFetch` should do this automatically for you.)
2079
- *
2080
- * @example
2081
- * ```ts
2082
- * // This would be unsafe in a dynamic page (e.g. `[slug].vue`) because the route slug makes a difference
2083
- * // to the data fetched, but Nuxt can't know that because it's not reflected in the key.
2084
- * const route = useRoute()
2085
- * const { data } = await useAsyncData(async () => {
2086
- * return await $fetch(`/api/my-page/${route.params.slug}`)
2087
- * })
2088
- * // Instead, you should use a key that uniquely identifies the data fetched.
2089
- * const { data } = await useAsyncData(route.params.slug, async () => {
2090
- * return await $fetch(`/api/my-page/${route.params.slug}`)
2091
- * })
2092
- * ```
2093
- */
2094
- sharedPrerenderData: boolean;
2095
- /**
2096
- * Enables CookieStore support to listen for cookie updates (if supported by the browser) and refresh `useCookie` ref values.
2097
- *
2098
- * @see [CookieStore](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore)
2099
- */
2100
- cookieStore: boolean;
2101
- /**
2102
- * Enable experimental Vite Environment API
2103
- */
2104
- viteEnvironmentApi: boolean;
2105
- /**
2106
- * This allows specifying the default options for core Nuxt components and composables.
2107
- *
2108
- * These options will likely be moved elsewhere in the future, such as into `app.config` or into the `app/` directory.
2109
- */
2110
- defaults: {
2111
- nuxtLink: NuxtLinkOptions;
2112
- /**
2113
- * Options that apply to `useAsyncData` (and also therefore `useFetch`)
2114
- */
2115
- useAsyncData: {
2116
- deep: boolean;
2117
- };
2118
- useFetch: Pick<FetchOptions, 'timeout' | 'retry' | 'retryDelay' | 'retryStatusCodes'>;
2119
- };
2120
- /**
2121
- * Automatically polyfill Node.js imports in the client build using `unenv`.
2122
- *
2123
- * @see [unenv](https://github.com/unjs/unenv)
2124
- *
2125
- * **Note:** To make globals like `Buffer` work in the browser, you need to manually inject them.
2126
- *
2127
- * ```ts
2128
- * import { Buffer } from 'node:buffer'
2129
- *
2130
- * globalThis.Buffer = globalThis.Buffer || Buffer
2131
- * ```
2132
- */
2133
- clientNodeCompat: boolean;
2134
- /**
2135
- * Wait for a single animation frame before navigation, which gives an opportunity for the browser to repaint, acknowledging user interaction.
2136
- *
2137
- * It can reduce INP when navigating on prerendered routes.
2138
- */
2139
- navigationRepaint: boolean;
2140
- /**
2141
- * Cache Nuxt/Nitro build artifacts based on a hash of the configuration and source files.
2142
- *
2143
- * This only works for source files within `srcDir` and `serverDir` for the Vue/Nitro parts of your app.
2144
- */
2145
- buildCache: boolean;
2146
- /**
2147
- * Ensure that auto-generated Vue component names match the full component name you would use to auto-import the component.
2148
- */
2149
- normalizeComponentNames: boolean;
2150
- /**
2151
- * Keep showing the spa-loading-template until suspense:resolve
2152
- *
2153
- * @see [Nuxt Issues #21721](https://github.com/nuxt/nuxt/issues/21721)
2154
- */
2155
- spaLoadingTemplateLocation: 'body' | 'within';
2156
- /**
2157
- * Enable timings for Nuxt application hooks in the performance panel of Chromium-based browsers.
2158
- *
2159
- * This feature adds performance markers for Nuxt hooks, allowing you to track their execution time in the browser's Performance tab. This is particularly useful for debugging performance issues.
2160
- *
2161
- * @example
2162
- * ```ts
2163
- * // nuxt.config.ts
2164
- * export default defineNuxtConfig({
2165
- * experimental: {
2166
- * // Enable performance markers for Nuxt hooks in browser devtools
2167
- * browserDevtoolsTiming: true
2168
- * }
2169
- * })
2170
- * ```
2171
- *
2172
- * @see [PR #29922](https://github.com/nuxt/nuxt/pull/29922)
2173
- *
2174
- * @see [Chrome DevTools Performance API](https://developer.chrome.com/docs/devtools/performance/extension#tracks)
2175
- */
2176
- browserDevtoolsTiming: boolean;
2177
- /**
2178
- * Enable integration with Chrome DevTools Workspaces
2179
- * for Nuxt projects.
2180
- *
2181
- * @default true
2182
- * @see [Chrome DevTools Project Settings](https://docs.google.com/document/d/1rfKPnxsNuXhnF7AiQZhu9kIwdiMS5hnAI05HBwFuBSM/edit)
2183
- */
2184
- chromeDevtoolsProjectSettings: boolean;
2185
- /**
2186
- * Record mutations to `nuxt.options` in module context, helping to debug configuration changes made by modules during the Nuxt initialization phase.
2187
- *
2188
- * When enabled, Nuxt will track which modules modify configuration options, making it easier to trace unexpected configuration changes.
2189
- *
2190
- * @example
2191
- * ```ts
2192
- * // nuxt.config.ts
2193
- * export default defineNuxtConfig({
2194
- * experimental: {
2195
- * // Enable tracking of config mutations by modules
2196
- * debugModuleMutation: true
2197
- * }
2198
- * })
2199
- * ```
2200
- *
2201
- * @see [PR #30555](https://github.com/nuxt/nuxt/pull/30555)
2202
- */
2203
- debugModuleMutation: boolean;
2204
- /**
2205
- * Enable automatic configuration of hydration strategies for `<Lazy>` components.
2206
- *
2207
- * This feature intelligently determines when to hydrate lazy components based on visibility, idle time, or other triggers, improving performance by deferring hydration of components until they're needed.
2208
- *
2209
- * @example
2210
- * ```ts
2211
- * // nuxt.config.ts
2212
- * export default defineNuxtConfig({
2213
- * experimental: {
2214
- * lazyHydration: true // Enable smart hydration strategies for Lazy components
2215
- * }
2216
- * })
2217
- *
2218
- * // In your Vue components
2219
- * <template>
2220
- * <Lazy>
2221
- * <ExpensiveComponent />
2222
- * </Lazy>
2223
- * </template>
2224
- * ```
2225
- *
2226
- * @see [PR #26468](https://github.com/nuxt/nuxt/pull/26468)
2227
- */
2228
- lazyHydration: boolean;
2229
- /**
2230
- * Disable resolving imports into Nuxt templates from the path of the module that added the template.
2231
- *
2232
- * By default, Nuxt attempts to resolve imports in templates relative to the module that added them. Setting this to `false` disables this behavior, which may be useful if you're experiencing resolution conflicts in certain environments.
2233
- *
2234
- * @example
2235
- * ```ts
2236
- * // nuxt.config.ts
2237
- * export default defineNuxtConfig({
2238
- * experimental: {
2239
- * // Disable template import resolution from module path
2240
- * templateImportResolution: false
2241
- * }
2242
- * })
2243
- * ```
2244
- *
2245
- * @see [PR #31175](https://github.com/nuxt/nuxt/pull/31175)
2246
- */
2247
- templateImportResolution: boolean;
2248
- /**
2249
- * Whether to clean up Nuxt static and asyncData caches on route navigation.
2250
- *
2251
- * Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks and ensures fresh data is loaded when needed, but it is possible to disable it.
2252
- *
2253
- * @example
2254
- * ```ts
2255
- * // nuxt.config.ts
2256
- * export default defineNuxtConfig({
2257
- * experimental: {
2258
- * // Disable automatic cache cleanup (default is true)
2259
- * purgeCachedData: false
2260
- * }
2261
- * })
2262
- * ```
2263
- *
2264
- * @see [PR #31379](https://github.com/nuxt/nuxt/pull/31379)
2265
- */
2266
- purgeCachedData: boolean;
2267
- /**
2268
- * Whether to call and use the result from `getCachedData` on manual refresh for `useAsyncData` and `useFetch`.
2269
- */
2270
- granularCachedData: boolean;
2271
- /**
2272
- * Whether to run `useFetch` when the key changes, even if it is set to `immediate: false` and it has not been triggered yet.
2273
- *
2274
- * `useFetch` and `useAsyncData` will always run when the key changes if `immediate: true` or if it has been already triggered.
2275
- */
2276
- alwaysRunFetchOnKeyChange: boolean;
2277
- /**
2278
- * Whether to parse `error.data` when rendering a server error page.
2279
- */
2280
- parseErrorData: boolean;
2281
- /**
2282
- * Whether Nuxt should stop if a Nuxt module is incompatible.
2283
- */
2284
- enforceModuleCompatibility: boolean;
2285
- /**
2286
- * For `useAsyncData` and `useFetch`, whether `pending` should be `true` when data has not yet started to be fetched.
2287
- */
2288
- pendingWhenIdle: boolean;
2289
- /**
2290
- * Whether to improve chunk stability by using an import map to resolve the entry chunk of the bundle.
2291
- */
2292
- entryImportMap: boolean;
2293
- /**
2294
- * Extract async data handler functions into separate chunks for better performance and caching.
2295
- *
2296
- * When enabled, handler functions passed to `useAsyncData` and `useLazyAsyncData` will be extracted
2297
- * into separate chunks and dynamically imported, allowing for better code splitting and caching.
2298
- *
2299
- * @experimental This is an experimental feature and API may change in the future.
2300
- */
2301
- extractAsyncDataHandlers: boolean;
2302
- /**
2303
- * Whether to enable `@dxup/nuxt` module for better TypeScript DX.
2304
- *
2305
- * @see https://github.com/KazariEX/dxup
2306
- */
2307
- typescriptPlugin: boolean;
2308
- };
2309
- /**
2310
- *
2311
- * @private
2312
- */
2313
- _majorVersion: number;
2314
- /**
2315
- *
2316
- * @private
2317
- */
2318
- _prepare: boolean;
2319
- /**
2320
- *
2321
- * @private
2322
- */
2323
- _requiredModules: Record<string, boolean>;
2324
- /**
2325
- *
2326
- * @private
2327
- */
2328
- _loadOptions: {
2329
- dotenv?: boolean | DotenvOptions;
2330
- };
2331
- /**
2332
- *
2333
- * @private
2334
- */
2335
- _nuxtConfigFile: string;
2336
- /**
2337
- *
2338
- * @private
2339
- */
2340
- _nuxtConfigFiles: Array<string>;
2341
- /**
2342
- *
2343
- * @private
2344
- */
2345
- appDir: string;
2346
- /**
2347
- *
2348
- * @private
2349
- */
2350
- _installedModules: Array<{
2351
- meta: ModuleMeta;
2352
- module: NuxtModule;
2353
- timings?: Record<string, number | undefined>;
2354
- entryPath?: string;
2355
- }>;
2356
- /**
2357
- *
2358
- * @private
2359
- */
2360
- _modules: Array<any>;
2361
- /**
2362
- * Configuration for Nuxt's server builder.
2363
- */
2364
- server: {
2365
- builder?: '@nuxt/nitro-server' | (string & {}) | {
2366
- bundle: (nuxt: Nuxt) => Promise<void>;
2367
- };
2368
- };
2369
- /**
2370
- * Configuration for Nitro.
2371
- *
2372
- * @see [Nitro configuration docs](https://nitro.build/config)
2373
- */
2374
- nitro: NitroConfig;
2375
- /**
2376
- * Global route options applied to matching server routes.
2377
- *
2378
- * @experimental This is an experimental feature and API may change in the future.
2379
- *
2380
- * @see [Nitro route rules documentation](https://nitro.build/config#routerules)
2381
- */
2382
- routeRules: NitroConfig['routeRules'];
2383
- /**
2384
- * Nitro server handlers.
2385
- *
2386
- * Each handler accepts the following options:
2387
- * - handler: The path to the file defining the handler. - route: The route under which the handler is available. This follows the conventions of [rou3](https://github.com/h3js/rou3). - method: The HTTP method of requests that should be handled. - middleware: Specifies whether it is a middleware handler. - lazy: Specifies whether to use lazy loading to import the handler.
2388
- *
2389
- * @see [`server/` directory documentation](https://nuxt.com/docs/4.x/directory-structure/server)
2390
- *
2391
- * @note Files from `server/api`, `server/middleware` and `server/routes` will be automatically registered by Nuxt.
2392
- *
2393
- * @example
2394
- * ```js
2395
- * serverHandlers: [
2396
- * { route: '/path/foo/**:name', handler: '~/server/foohandler.ts' }
2397
- * ]
2398
- * ```
2399
- */
2400
- serverHandlers: NitroEventHandler[];
2401
- /**
2402
- * Nitro development-only server handlers.
2403
- *
2404
- * @see [Nitro server routes documentation](https://nitro.build/guide/routing)
2405
- */
2406
- devServerHandlers: NitroDevEventHandler[];
2407
- postcss: {
2408
- /**
2409
- * A strategy for ordering PostCSS plugins.
2410
- */
2411
- order: 'cssnanoLast' | 'autoprefixerLast' | 'autoprefixerAndCssnanoLast' | string[] | ((names: string[]) => string[]);
2412
- /**
2413
- * Options for configuring PostCSS plugins.
2414
- *
2415
- * @see [PostCSS docs](https://postcss.org/)
2416
- */
2417
- plugins: Record<string, unknown> & {
2418
- autoprefixer?: false | Options$1;
2419
- cssnano?: false | Options$2;
2420
- };
2421
- };
2422
- router: {
2423
- /**
2424
- * Additional router options passed to `vue-router`. On top of the options for `vue-router`, Nuxt offers additional options to customize the router (see below).
2425
- *
2426
- * @note Only JSON serializable options should be passed by Nuxt config.
2427
- * For more control, you can use `app/router.options.ts` file.
2428
- *
2429
- * @see [Vue Router documentation](https://router.vuejs.org/api/interfaces/routeroptions)
2430
- */
2431
- options: RouterConfigSerializable;
2432
- };
2433
- /**
2434
- * Configuration for Nuxt's TypeScript integration.
2435
- */
2436
- typescript: {
2437
- /**
2438
- * TypeScript comes with certain checks to give you more safety and analysis of your program. Once you’ve converted your codebase to TypeScript, you can start enabling these checks for greater safety. [Read More](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks)
2439
- *
2440
- */
2441
- strict: boolean;
2442
- /**
2443
- * Which builder types to include for your project.
2444
- *
2445
- * By default Nuxt infers this based on your `builder` option (defaulting to 'vite') but you can either turn off builder environment types (with `false`) to handle this fully yourself, or opt for a 'shared' option.
2446
- * The 'shared' option is advised for module authors, who will want to support multiple possible builders.
2447
- */
2448
- builder: 'vite' | 'webpack' | 'rspack' | 'shared' | false | undefined | null;
2449
- /**
2450
- * Modules to generate deep aliases for within `compilerOptions.paths`. This does not yet support subpaths. It may be necessary when using Nuxt within a pnpm monorepo with `shamefully-hoist=false`.
2451
- */
2452
- hoist: Array<string>;
2453
- /**
2454
- * Include parent workspace in the Nuxt project. Mostly useful for themes and module authors.
2455
- */
2456
- includeWorkspace: boolean;
2457
- /**
2458
- * Enable build-time type checking.
2459
- *
2460
- * If set to true, this will type check in development. You can restrict this to build-time type checking by setting it to `build`. Requires to install `typescript` and `vue-tsc` as dev dependencies.
2461
- *
2462
- * @see [Nuxt TypeScript docs](https://nuxt.com/docs/4.x/guide/concepts/typescript)
2463
- */
2464
- typeCheck: boolean | 'build';
2465
- /**
2466
- * You can extend the generated `.nuxt/tsconfig.app.json` (and legacy `.nuxt/tsconfig.json`) using this option.
2467
- */
2468
- tsConfig: 0 extends 1 & RawVueCompilerOptions ? TSConfig : TSConfig & {
2469
- vueCompilerOptions?: RawVueCompilerOptions;
2470
- };
2471
- /**
2472
- * You can extend the generated `.nuxt/tsconfig.node.json` using this option.
2473
- */
2474
- nodeTsConfig: TSConfig;
2475
- /**
2476
- * You can extend the generated `.nuxt/tsconfig.shared.json` using this option.
2477
- */
2478
- sharedTsConfig: TSConfig;
2479
- /**
2480
- * Generate a `*.vue` shim.
2481
- *
2482
- * We recommend instead letting the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) generate accurate types for your components.
2483
- * Note that you may wish to set this to `true` if you are using other libraries, such as ESLint, that are unable to understand the type of `.vue` files.
2484
- */
2485
- shim: boolean;
2486
- };
2487
- esbuild: {
2488
- /**
2489
- * Configure shared esbuild options used within Nuxt and passed to other builders, such as Vite or Webpack.
2490
- */
2491
- options: TransformOptions;
2492
- };
2493
- oxc: {
2494
- transform: {
2495
- options: TransformOptions$1;
2496
- };
2497
- };
2498
- /**
2499
- * Configuration that will be passed directly to Vite.
2500
- *
2501
- * @see [Vite configuration docs](https://vite.dev/config/) for more information.
2502
- * Please note that not all vite options are supported in Nuxt.
2503
- */
2504
- vite: ViteOptions;
2505
- webpack: {
2506
- /**
2507
- * Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
2508
- *
2509
- * Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options).
2510
- *
2511
- * @example
2512
- * ```js
2513
- * analyze: {
2514
- * analyzerMode: 'static'
2515
- * }
2516
- * ```
2517
- */
2518
- analyze: boolean | {
2519
- enabled?: boolean;
2520
- } & BundleAnalyzerPlugin.Options;
2521
- /**
2522
- * Enable the profiler in webpackbar.
2523
- *
2524
- * It is normally enabled by CLI argument `--profile`.
2525
- *
2526
- * @see [webpackbar](https://github.com/unjs/webpackbar#profile).
2527
- */
2528
- profile: boolean;
2529
- /**
2530
- * Enables Common CSS Extraction.
2531
- *
2532
- * Using [mini-css-extract-plugin](https://github.com/webpack/mini-css-extract-plugin) under the hood, your CSS will be extracted into separate files, usually one per component. This allows caching your CSS and JavaScript separately.
2533
- *
2534
- * @example
2535
- * ```js
2536
- * export default {
2537
- * webpack: {
2538
- * extractCSS: true,
2539
- * // or
2540
- * extractCSS: {
2541
- * ignoreOrder: true
2542
- * }
2543
- * }
2544
- * }
2545
- * ```
2546
- *
2547
- * If you want to extract all your CSS to a single file, there is a workaround for this.
2548
- * However, note that it is not recommended to extract everything into a single file.
2549
- * Extracting into multiple CSS files is better for caching and preload isolation. It
2550
- * can also improve page performance by downloading and resolving only those resources
2551
- * that are needed.
2552
- *
2553
- * @example
2554
- * ```js
2555
- * export default {
2556
- * webpack: {
2557
- * extractCSS: true,
2558
- * optimization: {
2559
- * splitChunks: {
2560
- * cacheGroups: {
2561
- * styles: {
2562
- * name: 'styles',
2563
- * test: /\.(css|vue)$/,
2564
- * chunks: 'all',
2565
- * enforce: true
2566
- * }
2567
- * }
2568
- * }
2569
- * }
2570
- * }
2571
- * }
2572
- * ```
2573
- */
2574
- extractCSS: boolean | PluginOptions;
2575
- /**
2576
- * Enables CSS source map support (defaults to `true` in development).
2577
- */
2578
- cssSourceMap: boolean;
2579
- /**
2580
- * The polyfill library to load to provide URL and URLSearchParams.
2581
- *
2582
- * Defaults to `'url'` ([see package](https://www.npmjs.com/package/url)).
2583
- */
2584
- serverURLPolyfill: string;
2585
- /**
2586
- * Customize bundle filenames.
2587
- *
2588
- * To understand a bit more about the use of manifests, take a look at [webpack documentation](https://webpack.js.org/guides/code-splitting/).
2589
- *
2590
- * @note Be careful when using non-hashed based filenames in production
2591
- * as most browsers will cache the asset and not detect the changes on first load.
2592
- *
2593
- * This example changes fancy chunk names to numerical ids:
2594
- *
2595
- * @example
2596
- * ```js
2597
- * filenames: {
2598
- * chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js')
2599
- * }
2600
- * ```
2601
- */
2602
- filenames: Record<string, string | ((ctx: {
2603
- nuxt: Nuxt;
2604
- options: NuxtOptions;
2605
- name: string;
2606
- isDev: boolean;
2607
- isServer: boolean;
2608
- isClient: boolean;
2609
- alias: {
2610
- [index: string]: string | false | string[];
2611
- };
2612
- transpile: RegExp[];
2613
- }) => string)>;
2614
- /**
2615
- * Customize the options of Nuxt's integrated webpack loaders.
2616
- */
2617
- loaders: {
2618
- /**
2619
- * @see [esbuild loader](https://github.com/privatenumber/esbuild-loader)
2620
- */
2621
- esbuild: Omit<LoaderOptions, 'loader'>;
2622
- /**
2623
- * @see [`file-loader` Options](https://github.com/webpack/file-loader#options)
2624
- */
2625
- file: {
2626
- esModule: boolean;
2627
- limit: number;
2628
- };
2629
- /**
2630
- * @see [`file-loader` Options](https://github.com/webpack/file-loader#options)
2631
- */
2632
- fontUrl: {
2633
- esModule: boolean;
2634
- limit: number;
2635
- };
2636
- /**
2637
- * @see [`file-loader` Options](https://github.com/webpack/file-loader#options)
2638
- */
2639
- imgUrl: {
2640
- esModule: boolean;
2641
- limit: number;
2642
- };
2643
- /**
2644
- * @see [`pug` options](https://pugjs.org/api/reference.html#options)
2645
- */
2646
- pugPlain: Options$3;
2647
- /**
2648
- * See [vue-loader](https://github.com/vuejs/vue-loader) for available options.
2649
- */
2650
- vue: Partial<VueLoaderOptions>;
2651
- /**
2652
- * See [css-loader](https://github.com/webpack/css-loader) for available options.
2653
- */
2654
- css: {
2655
- importLoaders: number;
2656
- url: boolean | {
2657
- filter: (url: string, resourcePath: string) => boolean;
2658
- };
2659
- esModule: boolean;
2660
- };
2661
- /**
2662
- * See [css-loader](https://github.com/webpack/css-loader) for available options.
2663
- */
2664
- cssModules: {
2665
- importLoaders: number;
2666
- url: boolean | {
2667
- filter: (url: string, resourcePath: string) => boolean;
2668
- };
2669
- esModule: boolean;
2670
- modules: {
2671
- localIdentName: string;
2672
- };
2673
- };
2674
- /**
2675
- * @see [`less-loader` Options](https://github.com/webpack/less-loader#options)
2676
- */
2677
- less: any;
2678
- /**
2679
- * @see [`sass-loader` Options](https://github.com/webpack/sass-loader#options)
2680
- */
2681
- sass: {
2682
- sassOptions: {
2683
- indentedSyntax: boolean;
2684
- };
2685
- };
2686
- /**
2687
- * @see [`sass-loader` Options](https://github.com/webpack/sass-loader#options)
2688
- */
2689
- scss: any;
2690
- /**
2691
- * @see [`stylus-loader` Options](https://github.com/webpack/stylus-loader#options)
2692
- */
2693
- stylus: any;
2694
- vueStyle: any;
2695
- };
2696
- /**
2697
- * Add webpack plugins.
2698
- *
2699
- * @example
2700
- * ```js
2701
- * import webpack from 'webpack'
2702
- * import { version } from './package.json.ts'
2703
- * // ...
2704
- * plugins: [
2705
- * new webpack.DefinePlugin({
2706
- * 'process.VERSION': version
2707
- * })
2708
- * ]
2709
- * ```
2710
- */
2711
- plugins: Array<any>;
2712
- /**
2713
- * Hard-replaces `typeof process`, `typeof window` and `typeof document` to tree-shake bundle.
2714
- */
2715
- aggressiveCodeRemoval: boolean;
2716
- /**
2717
- * OptimizeCSSAssets plugin options.
2718
- *
2719
- * Defaults to true when `extractCSS` is enabled.
2720
- *
2721
- * @see [css-minimizer-webpack-plugin documentation](https://github.com/webpack/css-minimizer-webpack-plugin).
2722
- */
2723
- optimizeCSS: false | BasePluginOptions & DefinedDefaultMinimizerAndOptions<{}>;
2724
- /**
2725
- * Configure [webpack optimization](https://webpack.js.org/configuration/optimization/).
2726
- */
2727
- optimization: false | Configuration['optimization'];
2728
- /**
2729
- * Customize PostCSS Loader. same options as [`postcss-loader` options](https://github.com/webpack/postcss-loader#options)
2730
- */
2731
- postcss: {
2732
- execute?: boolean;
2733
- postcssOptions: ProcessOptions & {
2734
- plugins: Record<string, unknown> & {
2735
- autoprefixer?: Options$1;
2736
- cssnano?: Options$2;
2737
- };
2738
- };
2739
- sourceMap?: boolean;
2740
- implementation?: any;
2741
- };
2742
- /**
2743
- * See [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) for available options.
2744
- */
2745
- devMiddleware: Options$4<IncomingMessage, ServerResponse>;
2746
- /**
2747
- * See [webpack-hot-middleware](https://github.com/webpack/webpack-hot-middleware) for available options.
2748
- */
2749
- hotMiddleware: MiddlewareOptions & {
2750
- client?: ClientOptions;
2751
- };
2752
- /**
2753
- * Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin).
2754
- */
2755
- friendlyErrors: boolean;
2756
- /**
2757
- * Filters to hide build warnings.
2758
- */
2759
- warningIgnoreFilters: Array<(warn: WebpackError | Error) => boolean>;
2760
- /**
2761
- * Configure [webpack experiments](https://webpack.js.org/configuration/experiments/)
2762
- */
2763
- experiments: false | Configuration['experiments'];
2764
- };
2765
- }
2766
-
2767
- type DeepPartial<T> = T extends Function ? T : T extends Record<string, any> ? {
2768
- [P in keyof T]?: DeepPartial<T[P]>;
2769
- } : T;
2770
- type UpperSnakeCase<S extends string> = Uppercase<SnakeCase<S>>;
2771
- type RuntimeValue<T, B extends string> = T & {};
2772
- type Overrideable<T extends Record<string, any>, Path extends string = ''> = {
2773
- [K in keyof T]?: K extends string ? unknown extends T[K] ? unknown : T[K] extends Record<string, unknown> ? RuntimeValue<Overrideable<T[K], `${Path}_${UpperSnakeCase<K>}`>, `You can override this value at runtime with NUXT${Path}_${UpperSnakeCase<K>}`> : RuntimeValue<T[K], `You can override this value at runtime with NUXT${Path}_${UpperSnakeCase<K>}`> : K extends number ? T[K] : never;
2774
- };
2775
- type RuntimeConfigNamespace = Record<string, unknown>;
2776
- interface PublicRuntimeConfig extends RuntimeConfigNamespace {
2777
- }
2778
- interface RuntimeConfig extends RuntimeConfigNamespace {
2779
- app: NitroRuntimeConfigApp;
2780
- /** Only available on the server. */
2781
- nitro?: NitroRuntimeConfig['nitro'];
2782
- public: PublicRuntimeConfig;
2783
- }
2784
- interface NuxtConfig extends DeepPartial<Omit<ConfigSchema, 'components' | 'vue' | 'vite' | 'runtimeConfig' | 'webpack' | 'nitro'>> {
2785
- components?: ConfigSchema['components'];
2786
- vue?: Omit<DeepPartial<ConfigSchema['vue']>, 'config'> & {
2787
- config?: Partial<Filter<AppConfig$1, string | boolean>>;
2788
- };
2789
- vite?: ConfigSchema['vite'];
2790
- nitro?: NitroConfig;
2791
- runtimeConfig?: Overrideable<RuntimeConfig>;
2792
- webpack?: DeepPartial<ConfigSchema['webpack']> & {
2793
- $client?: DeepPartial<ConfigSchema['webpack']>;
2794
- $server?: DeepPartial<ConfigSchema['webpack']>;
2795
- };
2796
- /**
2797
- * Experimental custom config schema
2798
- * @see [Nuxt Issue #15592](https://github.com/nuxt/nuxt/issues/15592)
2799
- */
2800
- $schema?: SchemaDefinition;
2801
- }
2802
- type NuxtConfigLayer = ResolvedConfig<NuxtConfig & {
2803
- srcDir: ConfigSchema['srcDir'];
2804
- rootDir: ConfigSchema['rootDir'];
2805
- }> & {
2806
- cwd: string;
2807
- configFile: string;
2808
- };
2809
- interface NuxtBuilder {
2810
- bundle: (nuxt: Nuxt) => Promise<void>;
2811
- }
2812
- interface NuxtOptions extends Omit<ConfigSchema, 'vue' | 'sourcemap' | 'debug' | 'builder' | 'postcss' | 'webpack'> {
2813
- vue: Omit<ConfigSchema['vue'], 'config'> & {
2814
- config?: Partial<Filter<AppConfig$1, string | boolean>>;
2815
- };
2816
- sourcemap: Required<Exclude<ConfigSchema['sourcemap'], boolean>>;
2817
- debug: Required<Exclude<ConfigSchema['debug'], true>>;
2818
- builder: '@nuxt/vite-builder' | '@nuxt/webpack-builder' | '@nuxt/rspack-builder' | NuxtBuilder;
2819
- postcss: Omit<ConfigSchema['postcss'], 'order'> & {
2820
- order: Exclude<ConfigSchema['postcss']['order'], string>;
2821
- };
2822
- webpack: ConfigSchema['webpack'] & {
2823
- $client: ConfigSchema['webpack'];
2824
- $server: ConfigSchema['webpack'];
2825
- };
2826
- _layers: readonly NuxtConfigLayer[];
2827
- $schema: SchemaDefinition;
2828
- }
2829
- interface ViteConfig extends Omit<UserConfig, 'publicDir'> {
2830
- /** The path to the entrypoint for the Vite build. */
2831
- entry?: string;
2832
- /**
2833
- * Options passed to @vitejs/plugin-vue.
2834
- * @see [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue)
2835
- */
2836
- vue?: Options$5;
2837
- /**
2838
- * Options passed to @vitejs/plugin-vue-jsx.
2839
- * @see [@vitejs/plugin-vue-jsx.](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx)
2840
- */
2841
- vueJsx?: Options$6;
2842
- /**
2843
- * Warmup vite entrypoint caches on dev startup.
2844
- */
2845
- warmupEntry?: boolean;
2846
- /**
2847
- * Use environment variables or top level `server` options to configure Nuxt server.
2848
- */
2849
- server?: Omit<ServerOptions, 'port' | 'host'>;
2850
- /**
2851
- * Directly configuring the `vite.publicDir` option is not supported. Instead, set `dir.public`.
2852
- *
2853
- * You can read more in <https://nuxt.com/docs/4.x/api/nuxt-config#public>.
2854
- * @deprecated
2855
- */
2856
- publicDir?: never;
2857
- }
2858
- interface ViteOptions extends ViteConfig {
2859
- }
2860
- interface CustomAppConfig {
2861
- [key: string]: unknown;
2862
- }
2863
- interface AppConfigInput extends CustomAppConfig {
2864
- /** @deprecated reserved */
2865
- private?: never;
2866
- /** @deprecated reserved */
2867
- nuxt?: never;
2868
- /** @deprecated reserved */
2869
- nitro?: never;
2870
- /** @deprecated reserved */
2871
- server?: never;
2872
- }
2873
- type Serializable<T> = T extends Function ? never : T extends Promise<infer U> ? Serializable<U> : T extends string & {} ? T : T extends Record<string, any> ? {
2874
- [K in keyof T]: Serializable<T[K]>;
2875
- } : T;
2876
- type ValueOf<T> = T[keyof T];
2877
- type Filter<T extends Record<string, any>, V> = Pick<T, ValueOf<{
2878
- [K in keyof T]: NonNullable<T[K]> extends V ? K : never;
2879
- }>>;
2880
- interface NuxtAppConfig {
2881
- head: Serializable<AppHeadMetaObject>;
2882
- layoutTransition: boolean | Serializable<TransitionProps>;
2883
- pageTransition: boolean | Serializable<TransitionProps>;
2884
- viewTransition?: boolean | 'always';
2885
- keepalive: boolean | Serializable<KeepAliveProps>;
2886
- }
2887
- interface AppConfig {
2888
- [key: string]: unknown;
2889
- }
2890
-
2891
- declare const _default: any;
2892
-
2893
- export { _default as NuxtConfigSchema };
2894
- export type { AppConfig, AppConfigInput, AppHeadMetaObject, Component, ComponentMeta, ComponentsDir, ComponentsOptions, CustomAppConfig, GenerateAppOptions, HookResult, ImportPresetWithDeprecation, ImportsOptions, KeyedFunction, MetaObject, MetaObjectRaw, ModuleDefinition, ModuleDependencies, ModuleDependencyMeta, ModuleMeta, ModuleOptions, ModuleSetupInstallResult, ModuleSetupReturn, Nuxt, NuxtAnalyzeMeta, NuxtApp, NuxtAppConfig, NuxtBuilder, NuxtCompatibility, NuxtCompatibilityIssue, NuxtCompatibilityIssues, NuxtConfig, NuxtConfigLayer, NuxtDebugContext, NuxtDebugModuleMutationRecord, NuxtHookName, NuxtHooks, NuxtLayout, NuxtMiddleware, NuxtModule, NuxtOptions, NuxtPage, NuxtPlugin, NuxtPluginTemplate, NuxtServerTemplate, NuxtTemplate, NuxtTypeTemplate, PublicRuntimeConfig, ResolvedModuleOptions, ResolvedNuxtTemplate, RouterConfig, RouterConfigSerializable, RouterOptions, RuntimeConfig, RuntimeValue, ScanDir, TSReference, UpperSnakeCase, ViteConfig, ViteOptions, VueTSConfig, WatchEvent };