@nuxt/kit-nightly 4.3.0-29356103.2f7957ac → 4.3.0-29430576.f48ea4c8

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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- [![Nuxt banner](https://github.com/nuxt/nuxt/tree/main/.github/assets/banner.svg)](https://nuxt.com)
1
+ [![Nuxt banner](https://github.com/nuxt/nuxt/blob/main/.github/assets/banner.svg)](https://nuxt.com)
2
2
 
3
3
  # Nuxt
4
4
 
5
5
  <p>
6
6
  <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a>
7
7
  <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a>
8
- <a href="https://github.com/nuxt/nuxt/tree/main/LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
8
+ <a href="https://github.com/nuxt/nuxt/blob/main/LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
9
9
  <a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt%20Docs-18181B?logo=nuxt" alt="Website"></a>
10
10
  <a href="https://chat.nuxt.dev"><img src="https://img.shields.io/badge/Nuxt%20Discord-18181B?logo=discord" alt="Discord"></a>
11
11
  <a href="https://securityscorecards.dev/"><img src="https://api.securityscorecards.dev/projects/github.com/nuxt/nuxt/badge" alt="Nuxt openssf scorecard score"></a>
@@ -14,13 +14,13 @@
14
14
  Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.
15
15
 
16
16
  It provides a number of features that make it easy to build fast, SEO-friendly, and scalable web applications, including:
17
- - Server-side rendering, Static Site Generation, Hybrid Rendering and Edge-Side Rendering
17
+ - Server-side rendering, static site generation, hybrid rendering and edge-side rendering
18
18
  - Automatic routing with code-splitting and pre-fetching
19
19
  - Data fetching and state management
20
- - SEO Optimization and Meta tags definition
20
+ - Search engine optimization and defining meta tags
21
21
  - Auto imports of components, composables and utils
22
22
  - TypeScript with zero configuration
23
- - Go fullstack with our server/ directory
23
+ - Go full-stack with our server/ directory
24
24
  - Extensible with [200+ modules](https://nuxt.com/modules)
25
25
  - Deployment to a variety of [hosting platforms](https://nuxt.com/deploy)
26
26
  - ...[and much more](https://nuxt.com) 🚀
@@ -31,7 +31,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
31
31
  - 💻 [ Vue Development](#vue-development)
32
32
  - 📖 [Documentation](#documentation)
33
33
  - 🧩 [Modules](#modules)
34
- - ❤️ [Contribute](#contribute)
34
+ - ❤️ [Contribute](#contribute)
35
35
  - 🏠 [Local Development](#local-development)
36
36
  - 🛟 [Professional Support](#professional-support)
37
37
  - 🔗 [Follow Us](#follow-us)
@@ -109,9 +109,9 @@ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/
109
109
  ## <a name="follow-us">🔗 Follow Us</a>
110
110
 
111
111
  <p valign="center">
112
- <a href="https://go.nuxt.com/discord"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/discord.svg" alt="Discord"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/x"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/twitter.svg" alt="Twitter"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/github"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/github.svg" alt="GitHub"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/bluesky"><img width="20px" src="https://github.com/nuxt/nuxt/tree/main/.github/assets/bluesky.svg" alt="Bluesky"></a>
112
+ <a href="https://go.nuxt.com/discord"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/discord.svg" alt="Discord"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/x"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/twitter.svg" alt="Twitter"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/github"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/github.svg" alt="GitHub"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/bluesky"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/bluesky.svg" alt="Bluesky"></a>
113
113
  </p>
114
114
 
115
115
  ## <a name="license">⚖️ License</a>
116
116
 
117
- [MIT](https://github.com/nuxt/nuxt/tree/main/LICENSE)
117
+ [MIT](https://github.com/nuxt/nuxt/blob/main/LICENSE)
package/dist/index.d.mts CHANGED
@@ -1,15 +1,13 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
- import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, NuxtAppConfig, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, Component, ComponentsDir, NuxtTemplate, NuxtMiddleware, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
1
+ import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, NuxtAppConfig, NuxtCompatibility, NuxtCompatibilityIssues, Component, ComponentsDir, NuxtTemplate, NuxtMiddleware, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
3
2
  import { LoadConfigOptions } from 'c12';
4
- import { Import } from 'unimport';
3
+ import { Import, InlinePreset } from 'unimport';
5
4
  import { WebpackPluginInstance, Configuration } from 'webpack';
6
5
  import { RspackPluginInstance } from '@rspack/core';
7
6
  import { Plugin, UserConfig } from 'vite';
8
- import * as unctx from 'unctx';
7
+ import { UseContext } from 'unctx';
9
8
  import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types';
10
9
  import { GlobOptions } from 'tinyglobby';
11
- import * as consola from 'consola';
12
- import { ConsolaOptions } from 'consola';
10
+ import { ConsolaInstance, ConsolaOptions } from 'consola';
13
11
 
14
12
  /**
15
13
  * Define a Nuxt module, automatically merging defaults with user provided options, installing
@@ -52,7 +50,7 @@ declare const normalizeModuleTranspilePath: (p: string) => string;
52
50
  */
53
51
  declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
54
52
  /**
55
- * Checks if a Nuxt Module is compatible with a given semver version.
53
+ * Checks if a Nuxt module is compatible with a given semver version.
56
54
  */
57
55
  declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
58
56
  /**
@@ -111,7 +109,7 @@ interface LayerDirectories {
111
109
  * @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
112
110
  * @returns Array of LayerDirectories objects, ordered by priority (user layer first)
113
111
  */
114
- declare function getLayerDirectories(nuxt?: _nuxt_schema.Nuxt): LayerDirectories[];
112
+ declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
115
113
 
116
114
  declare function setGlobalHead(head: NuxtAppConfig['head']): void;
117
115
 
@@ -119,7 +117,7 @@ declare function addImports(imports: Import | Import[]): void;
119
117
  declare function addImportsDir(dirs: string | string[], opts?: {
120
118
  prepend?: boolean;
121
119
  }): void;
122
- declare function addImportsSources(presets: ImportPresetWithDeprecation | ImportPresetWithDeprecation[]): void;
120
+ declare function addImportsSources(presets: InlinePreset | InlinePreset[]): void;
123
121
 
124
122
  /**
125
123
  * Access 'resolved' Nuxt runtime configuration, with values updated from environment.
@@ -132,6 +130,8 @@ declare function useRuntimeConfig(): Record<string, any>;
132
130
  */
133
131
  declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
134
132
 
133
+ type Arrayable<T> = T | T[];
134
+ type Thenable<T> = T | Promise<T>;
135
135
  interface ExtendConfigOptions {
136
136
  /**
137
137
  * Install plugin on dev
@@ -178,40 +178,41 @@ interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, 'server' | '
178
178
  */
179
179
  client?: boolean;
180
180
  }
181
+ type ExtendWebpacklikeConfig = (fn: (config: Configuration) => void, options?: ExtendWebpackConfigOptions) => void;
181
182
  /**
182
183
  * Extend webpack config
183
184
  *
184
185
  * The fallback function might be called multiple times
185
186
  * when applying to both client and server builds.
186
187
  */
187
- declare const extendWebpackConfig: (fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions) => void;
188
+ declare const extendWebpackConfig: ExtendWebpacklikeConfig;
188
189
  /**
189
190
  * Extend rspack config
190
191
  *
191
192
  * The fallback function might be called multiple times
192
193
  * when applying to both client and server builds.
193
194
  */
194
- declare const extendRspackConfig: (fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions) => void;
195
+ declare const extendRspackConfig: ExtendWebpacklikeConfig;
195
196
  /**
196
197
  * Extend Vite config
197
198
  */
198
- declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): (() => void) | undefined;
199
+ declare function extendViteConfig(fn: ((config: UserConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
199
200
  /**
200
201
  * Append webpack plugin to the config.
201
202
  */
202
- declare function addWebpackPlugin(pluginOrGetter: WebpackPluginInstance | WebpackPluginInstance[] | (() => WebpackPluginInstance | WebpackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
203
+ declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
203
204
  /**
204
205
  * Append rspack plugin to the config.
205
206
  */
206
- declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance | RspackPluginInstance[] | (() => RspackPluginInstance | RspackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
207
+ declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackPluginInstance> | (() => Thenable<Arrayable<RspackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
207
208
  /**
208
209
  * Append Vite plugin to the config.
209
210
  */
210
- declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?: ExtendConfigOptions): void;
211
+ declare function addVitePlugin(pluginOrGetter: Arrayable<Plugin> | (() => Thenable<Arrayable<Plugin>>), options?: ExtendConfigOptions): void;
211
212
  interface AddBuildPluginFactory {
212
- vite?: () => Plugin | Plugin[];
213
- webpack?: () => WebpackPluginInstance | WebpackPluginInstance[];
214
- rspack?: () => RspackPluginInstance | RspackPluginInstance[];
213
+ vite?: () => Thenable<Arrayable<Plugin>>;
214
+ webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
215
+ rspack?: () => Thenable<Arrayable<RspackPluginInstance>>;
215
216
  }
216
217
  declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
217
218
 
@@ -270,7 +271,7 @@ declare function addComponent(opts: AddComponentOptions): void;
270
271
  * Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
271
272
  * @deprecated Use `getNuxtCtx` instead
272
273
  */
273
- declare const nuxtCtx: unctx.UseContext<Nuxt>;
274
+ declare const nuxtCtx: UseContext<Nuxt>;
274
275
  /** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
275
276
  declare const getNuxtCtx: () => Nuxt | null;
276
277
  /**
@@ -298,11 +299,11 @@ declare function useNuxt(): Nuxt;
298
299
  declare function tryUseNuxt(): Nuxt | null;
299
300
  declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
300
301
 
301
- declare function createIsIgnored(nuxt?: _nuxt_schema.Nuxt | null): (pathname: string, stats?: unknown) => boolean;
302
+ declare function createIsIgnored(nuxt?: Nuxt | null | undefined): (pathname: string, stats?: unknown) => boolean;
302
303
  /**
303
304
  * Return a filter function to filter an array of paths
304
305
  */
305
- declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: _nuxt_schema.Nuxt | null): boolean;
306
+ declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: Nuxt | null | undefined): boolean;
306
307
  declare function resolveIgnorePatterns(relativePath?: string): string[];
307
308
 
308
309
  declare function addLayout(template: NuxtTemplate | string, name?: string): void;
@@ -509,11 +510,11 @@ declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildD
509
510
  */
510
511
  declare function updateTemplates(options?: {
511
512
  filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
512
- }): Promise<any>;
513
+ }): Promise<void>;
513
514
  declare function writeTypes(nuxt: Nuxt): Promise<void>;
514
515
 
515
- declare const logger: consola.ConsolaInstance;
516
- declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola.ConsolaInstance;
516
+ declare const logger: ConsolaInstance;
517
+ declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
517
518
 
518
519
  interface ResolveModuleOptions {
519
520
  /** @deprecated use `url` with URLs pointing at a file - never a directory */
package/dist/index.d.ts CHANGED
@@ -1,15 +1,13 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
- import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, NuxtAppConfig, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, Component, ComponentsDir, NuxtTemplate, NuxtMiddleware, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
1
+ import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, NuxtAppConfig, NuxtCompatibility, NuxtCompatibilityIssues, Component, ComponentsDir, NuxtTemplate, NuxtMiddleware, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
3
2
  import { LoadConfigOptions } from 'c12';
4
- import { Import } from 'unimport';
3
+ import { Import, InlinePreset } from 'unimport';
5
4
  import { WebpackPluginInstance, Configuration } from 'webpack';
6
5
  import { RspackPluginInstance } from '@rspack/core';
7
6
  import { Plugin, UserConfig } from 'vite';
8
- import * as unctx from 'unctx';
7
+ import { UseContext } from 'unctx';
9
8
  import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types';
10
9
  import { GlobOptions } from 'tinyglobby';
11
- import * as consola from 'consola';
12
- import { ConsolaOptions } from 'consola';
10
+ import { ConsolaInstance, ConsolaOptions } from 'consola';
13
11
 
14
12
  /**
15
13
  * Define a Nuxt module, automatically merging defaults with user provided options, installing
@@ -52,7 +50,7 @@ declare const normalizeModuleTranspilePath: (p: string) => string;
52
50
  */
53
51
  declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
54
52
  /**
55
- * Checks if a Nuxt Module is compatible with a given semver version.
53
+ * Checks if a Nuxt module is compatible with a given semver version.
56
54
  */
57
55
  declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
58
56
  /**
@@ -111,7 +109,7 @@ interface LayerDirectories {
111
109
  * @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
112
110
  * @returns Array of LayerDirectories objects, ordered by priority (user layer first)
113
111
  */
114
- declare function getLayerDirectories(nuxt?: _nuxt_schema.Nuxt): LayerDirectories[];
112
+ declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
115
113
 
116
114
  declare function setGlobalHead(head: NuxtAppConfig['head']): void;
117
115
 
@@ -119,7 +117,7 @@ declare function addImports(imports: Import | Import[]): void;
119
117
  declare function addImportsDir(dirs: string | string[], opts?: {
120
118
  prepend?: boolean;
121
119
  }): void;
122
- declare function addImportsSources(presets: ImportPresetWithDeprecation | ImportPresetWithDeprecation[]): void;
120
+ declare function addImportsSources(presets: InlinePreset | InlinePreset[]): void;
123
121
 
124
122
  /**
125
123
  * Access 'resolved' Nuxt runtime configuration, with values updated from environment.
@@ -132,6 +130,8 @@ declare function useRuntimeConfig(): Record<string, any>;
132
130
  */
133
131
  declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
134
132
 
133
+ type Arrayable<T> = T | T[];
134
+ type Thenable<T> = T | Promise<T>;
135
135
  interface ExtendConfigOptions {
136
136
  /**
137
137
  * Install plugin on dev
@@ -178,40 +178,41 @@ interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, 'server' | '
178
178
  */
179
179
  client?: boolean;
180
180
  }
181
+ type ExtendWebpacklikeConfig = (fn: (config: Configuration) => void, options?: ExtendWebpackConfigOptions) => void;
181
182
  /**
182
183
  * Extend webpack config
183
184
  *
184
185
  * The fallback function might be called multiple times
185
186
  * when applying to both client and server builds.
186
187
  */
187
- declare const extendWebpackConfig: (fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions) => void;
188
+ declare const extendWebpackConfig: ExtendWebpacklikeConfig;
188
189
  /**
189
190
  * Extend rspack config
190
191
  *
191
192
  * The fallback function might be called multiple times
192
193
  * when applying to both client and server builds.
193
194
  */
194
- declare const extendRspackConfig: (fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions) => void;
195
+ declare const extendRspackConfig: ExtendWebpacklikeConfig;
195
196
  /**
196
197
  * Extend Vite config
197
198
  */
198
- declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): (() => void) | undefined;
199
+ declare function extendViteConfig(fn: ((config: UserConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
199
200
  /**
200
201
  * Append webpack plugin to the config.
201
202
  */
202
- declare function addWebpackPlugin(pluginOrGetter: WebpackPluginInstance | WebpackPluginInstance[] | (() => WebpackPluginInstance | WebpackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
203
+ declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
203
204
  /**
204
205
  * Append rspack plugin to the config.
205
206
  */
206
- declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance | RspackPluginInstance[] | (() => RspackPluginInstance | RspackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
207
+ declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackPluginInstance> | (() => Thenable<Arrayable<RspackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
207
208
  /**
208
209
  * Append Vite plugin to the config.
209
210
  */
210
- declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?: ExtendConfigOptions): void;
211
+ declare function addVitePlugin(pluginOrGetter: Arrayable<Plugin> | (() => Thenable<Arrayable<Plugin>>), options?: ExtendConfigOptions): void;
211
212
  interface AddBuildPluginFactory {
212
- vite?: () => Plugin | Plugin[];
213
- webpack?: () => WebpackPluginInstance | WebpackPluginInstance[];
214
- rspack?: () => RspackPluginInstance | RspackPluginInstance[];
213
+ vite?: () => Thenable<Arrayable<Plugin>>;
214
+ webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
215
+ rspack?: () => Thenable<Arrayable<RspackPluginInstance>>;
215
216
  }
216
217
  declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
217
218
 
@@ -270,7 +271,7 @@ declare function addComponent(opts: AddComponentOptions): void;
270
271
  * Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
271
272
  * @deprecated Use `getNuxtCtx` instead
272
273
  */
273
- declare const nuxtCtx: unctx.UseContext<Nuxt>;
274
+ declare const nuxtCtx: UseContext<Nuxt>;
274
275
  /** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
275
276
  declare const getNuxtCtx: () => Nuxt | null;
276
277
  /**
@@ -298,11 +299,11 @@ declare function useNuxt(): Nuxt;
298
299
  declare function tryUseNuxt(): Nuxt | null;
299
300
  declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
300
301
 
301
- declare function createIsIgnored(nuxt?: _nuxt_schema.Nuxt | null): (pathname: string, stats?: unknown) => boolean;
302
+ declare function createIsIgnored(nuxt?: Nuxt | null | undefined): (pathname: string, stats?: unknown) => boolean;
302
303
  /**
303
304
  * Return a filter function to filter an array of paths
304
305
  */
305
- declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: _nuxt_schema.Nuxt | null): boolean;
306
+ declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: Nuxt | null | undefined): boolean;
306
307
  declare function resolveIgnorePatterns(relativePath?: string): string[];
307
308
 
308
309
  declare function addLayout(template: NuxtTemplate | string, name?: string): void;
@@ -509,11 +510,11 @@ declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildD
509
510
  */
510
511
  declare function updateTemplates(options?: {
511
512
  filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
512
- }): Promise<any>;
513
+ }): Promise<void>;
513
514
  declare function writeTypes(nuxt: Nuxt): Promise<void>;
514
515
 
515
- declare const logger: consola.ConsolaInstance;
516
- declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola.ConsolaInstance;
516
+ declare const logger: ConsolaInstance;
517
+ declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
517
518
 
518
519
  interface ResolveModuleOptions {
519
520
  /** @deprecated use `url` with URLs pointing at a file - never a directory */
package/dist/index.mjs CHANGED
@@ -10,17 +10,17 @@ import { existsSync, readFileSync, promises, lstatSync } from 'node:fs';
10
10
  import { fileURLToPath, pathToFileURL } from 'node:url';
11
11
  import { resolve, relative, join, dirname, normalize, isAbsolute, basename, parse } from 'pathe';
12
12
  import { createJiti } from 'jiti';
13
- import { parseNodeModulePath, interopDefault, resolveModuleExportNames } from 'mlly';
13
+ import { parseNodeModulePath, interopDefault, lookupNodeModuleSubpath, resolveModuleExportNames } from 'mlly';
14
14
  import { resolveModulePath, resolveModuleURL } from 'exsolve';
15
- import { isRelative, withTrailingSlash as withTrailingSlash$2 } from 'ufo';
15
+ import { isRelative, withTrailingSlash as withTrailingSlash$2, withoutTrailingSlash } from 'ufo';
16
16
  import { read, update } from 'rc9';
17
17
  import semver, { gte } from 'semver';
18
18
  import { captureStackTrace } from 'errx';
19
+ import process from 'node:process';
19
20
  import { glob } from 'tinyglobby';
20
21
  import { resolveAlias as resolveAlias$1, reverseResolveAlias } from 'pathe/utils';
21
22
  import ignore from 'ignore';
22
23
  import { loadConfig } from 'c12';
23
- import process$1 from 'node:process';
24
24
  import destr from 'destr';
25
25
  import { snakeCase, pascalCase, kebabCase } from 'scule';
26
26
  import { klona } from 'klona';
@@ -569,7 +569,7 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
569
569
  localLayerModuleDirs.push(resolve(srcDir, l.config?.dir?.modules || "modules").replace(/\/?$/, "/"));
570
570
  }
571
571
  }
572
- const optionsFunctions = /* @__PURE__ */ new Map();
572
+ nuxt._moduleOptionsFunctions ||= /* @__PURE__ */ new Map();
573
573
  const resolvedModules = [];
574
574
  const inlineConfigKeys = new Set(
575
575
  await Promise.all([...modulesToInstall].map(([mod]) => typeof mod !== "string" && Promise.resolve(mod.getMeta?.())?.then((r) => r?.configKey)))
@@ -604,8 +604,8 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
604
604
  }
605
605
  }
606
606
  if (value.overrides || value.defaults) {
607
- const currentFns = optionsFunctions.get(resolvedModule.module) || [];
608
- optionsFunctions.set(resolvedModule.module, [
607
+ const currentFns = nuxt._moduleOptionsFunctions.get(resolvedModule.module) || [];
608
+ nuxt._moduleOptionsFunctions.set(resolvedModule.module, [
609
609
  ...currentFns,
610
610
  () => ({ defaults: value.defaults, overrides: value.overrides })
611
611
  ]);
@@ -640,25 +640,28 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
640
640
  }
641
641
  for (const { nuxtModule, meta, moduleToInstall, buildTimeModuleMeta, resolvedModulePath, inlineOptions } of resolvedModules) {
642
642
  const configKey = meta?.configKey;
643
- if (configKey) {
644
- const optionsFns = [
645
- ...optionsFunctions.get(moduleToInstall) || [],
646
- ...optionsFunctions.get(configKey) || []
647
- ];
648
- if (optionsFns.length > 0) {
649
- const overrides = [];
650
- const defaults = [];
651
- for (const fn of optionsFns) {
652
- const options = fn();
653
- overrides.push(options.overrides);
654
- defaults.push(options.defaults);
655
- }
643
+ const optionsFns = [
644
+ ...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
645
+ ...meta?.name ? nuxt._moduleOptionsFunctions.get(meta.name) || [] : [],
646
+ // TODO: consider dropping options functions keyed by config key
647
+ ...configKey ? nuxt._moduleOptionsFunctions.get(configKey) || [] : []
648
+ ];
649
+ if (optionsFns.length > 0) {
650
+ const overrides = [];
651
+ const defaults = [];
652
+ for (const fn of optionsFns) {
653
+ const options = fn();
654
+ overrides.push(options.overrides);
655
+ defaults.push(options.defaults);
656
+ }
657
+ if (configKey) {
656
658
  nuxt.options[configKey] = defu(...overrides, nuxt.options[configKey], ...defaults);
657
659
  }
658
660
  }
659
661
  await callLifecycleHooks(nuxtModule, meta, inlineOptions, nuxt);
660
662
  await callModule(nuxtModule, meta, inlineOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
661
663
  }
664
+ delete nuxt._moduleOptionsFunctions;
662
665
  }
663
666
  async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
664
667
  const { nuxtModule, buildTimeModuleMeta, resolvedModulePath } = await loadNuxtModuleInstance(moduleToInstall, nuxt);
@@ -669,8 +672,27 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
669
672
  }
670
673
  }
671
674
  const meta = await nuxtModule.getMeta?.();
672
- await callLifecycleHooks(nuxtModule, meta, inlineOptions, nuxt);
673
- await callModule(nuxtModule, meta, inlineOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
675
+ let mergedOptions = inlineOptions;
676
+ const configKey = meta?.configKey;
677
+ if (configKey && nuxt._moduleOptionsFunctions) {
678
+ const optionsFns = [
679
+ ...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
680
+ ...nuxt._moduleOptionsFunctions.get(configKey) || []
681
+ ];
682
+ if (optionsFns.length > 0) {
683
+ const overrides = [];
684
+ const defaults = [];
685
+ for (const fn of optionsFns) {
686
+ const options = fn();
687
+ overrides.push(options.overrides);
688
+ defaults.push(options.defaults);
689
+ }
690
+ mergedOptions = defu(inlineOptions, ...overrides, nuxt.options[configKey], ...defaults);
691
+ nuxt.options[configKey] = mergedOptions;
692
+ }
693
+ }
694
+ await callLifecycleHooks(nuxtModule, meta, mergedOptions, nuxt);
695
+ await callModule(nuxtModule, meta, mergedOptions, resolvedModulePath, moduleToInstall, localLayerModuleDirs, buildTimeModuleMeta, nuxt);
674
696
  }
675
697
  function resolveModuleWithOptions(definition, nuxt) {
676
698
  const [module, options = {}] = Array.isArray(definition) ? definition : [definition, {}];
@@ -786,8 +808,13 @@ async function callModule(nuxtModule, meta = {}, inlineOptions, resolvedModulePa
786
808
  return;
787
809
  }
788
810
  const modulePath = resolvedModulePath || moduleToInstall;
811
+ let entryPath;
789
812
  if (typeof modulePath === "string") {
790
813
  const parsed = parseNodeModulePath(modulePath);
814
+ if (parsed.name) {
815
+ const subpath = await lookupNodeModuleSubpath(modulePath) || ".";
816
+ entryPath = join(parsed.name, subpath === "./" ? "." : subpath);
817
+ }
791
818
  const moduleRoot = parsed.dir ? parsed.dir + parsed.name : await resolvePackageJSON(modulePath, { try: true }).then((r) => r ? dirname(r) : modulePath);
792
819
  nuxt.options.build.transpile.push(normalizeModuleTranspilePath(moduleRoot));
793
820
  const directory = moduleRoot.replace(/\/?$/, "/");
@@ -796,7 +823,7 @@ async function callModule(nuxtModule, meta = {}, inlineOptions, resolvedModulePa
796
823
  }
797
824
  }
798
825
  nuxt.options._installedModules ||= [];
799
- const entryPath = typeof moduleToInstall === "string" ? resolveAlias(moduleToInstall, nuxt.options.alias) : void 0;
826
+ entryPath ||= typeof moduleToInstall === "string" ? resolveAlias(moduleToInstall, nuxt.options.alias) : void 0;
800
827
  if (typeof moduleToInstall === "string" && entryPath !== moduleToInstall) {
801
828
  buildTimeModuleMeta.rawPath = moduleToInstall;
802
829
  }
@@ -860,7 +887,7 @@ async function loadNuxtConfig(opts) {
860
887
  const localLayers = (await glob("layers/*", {
861
888
  onlyDirectories: true,
862
889
  cwd: opts.cwd || process.cwd()
863
- })).map((d) => d.endsWith("/") ? d.substring(0, d.length - 1) : d).sort((a, b) => b.localeCompare(a));
890
+ })).map((d) => withTrailingSlash$2(d)).sort((a, b) => b.localeCompare(a));
864
891
  opts.overrides = defu$1(opts.overrides, { _extends: localLayers });
865
892
  const { configFile, layers = [], cwd, config: nuxtConfig, meta } = await withDefineNuxtConfig(
866
893
  () => loadConfig({
@@ -898,14 +925,17 @@ async function loadNuxtConfig(opts) {
898
925
  }
899
926
  const _layers = [];
900
927
  const processedLayers = /* @__PURE__ */ new Set();
901
- const localRelativePaths = new Set(localLayers);
928
+ const localRelativePaths = new Set(localLayers.map((layer) => withoutTrailingSlash(layer)));
902
929
  for (const layer of layers) {
903
- layer.config ||= {};
904
- layer.config.rootDir ??= layer.cwd;
905
- if (processedLayers.has(layer.config.rootDir)) {
930
+ const resolvedRootDir = layer.config?.rootDir ?? layer.cwd;
931
+ layer.config = {
932
+ ...layer.config || {},
933
+ rootDir: resolvedRootDir
934
+ };
935
+ if (processedLayers.has(resolvedRootDir)) {
906
936
  continue;
907
937
  }
908
- processedLayers.add(layer.config.rootDir);
938
+ processedLayers.add(resolvedRootDir);
909
939
  layer.config = await applyDefaults(layerSchema, layer.config);
910
940
  if (!layer.configFile || layer.configFile.endsWith(".nuxtrc")) {
911
941
  continue;
@@ -1085,7 +1115,7 @@ function useRuntimeConfig() {
1085
1115
  return applyEnv(klona(nuxt.options.nitro.runtimeConfig), {
1086
1116
  prefix: "NITRO_",
1087
1117
  altPrefix: "NUXT_",
1088
- envExpansion: nuxt.options.nitro.experimental?.envExpansion ?? !!process$1.env.NITRO_ENV_EXPANSION
1118
+ envExpansion: nuxt.options.nitro.experimental?.envExpansion ?? !!process.env.NITRO_ENV_EXPANSION
1089
1119
  });
1090
1120
  }
1091
1121
  function updateRuntimeConfig(runtimeConfig) {
@@ -1096,7 +1126,7 @@ function updateRuntimeConfig(runtimeConfig) {
1096
1126
  } catch {
1097
1127
  }
1098
1128
  }
1099
- function getEnv(key, opts, env = process$1.env) {
1129
+ function getEnv(key, opts, env = process.env) {
1100
1130
  const envKey = snakeCase(key).toUpperCase();
1101
1131
  return destr(
1102
1132
  env[opts.prefix + envKey] ?? env[opts.altPrefix + envKey]
@@ -1128,7 +1158,7 @@ function applyEnv(obj, opts, parentKey = "") {
1128
1158
  return obj;
1129
1159
  }
1130
1160
  const envExpandRx = /\{\{([^{}]*)\}\}/g;
1131
- function _expandFromEnv(value, env = process$1.env) {
1161
+ function _expandFromEnv(value, env = process.env) {
1132
1162
  return value.replace(envExpandRx, (match, key) => {
1133
1163
  return env[key] || match;
1134
1164
  });
@@ -1142,17 +1172,17 @@ const extendWebpackCompatibleConfig = (builder) => (fn, options = {}) => {
1142
1172
  if (options.build === false && nuxt.options.build) {
1143
1173
  return;
1144
1174
  }
1145
- nuxt.hook(`${builder}:config`, (configs) => {
1175
+ nuxt.hook(`${builder}:config`, async (configs) => {
1146
1176
  if (options.server !== false) {
1147
1177
  const config = configs.find((i) => i.name === "server");
1148
1178
  if (config) {
1149
- fn(config);
1179
+ await fn(config);
1150
1180
  }
1151
1181
  }
1152
1182
  if (options.client !== false) {
1153
1183
  const config = configs.find((i) => i.name === "client");
1154
1184
  if (config) {
1155
- fn(config);
1185
+ await fn(config);
1156
1186
  }
1157
1187
  }
1158
1188
  });
@@ -1176,17 +1206,17 @@ function extendViteConfig(fn, options = {}) {
1176
1206
  return nuxt.hook("vite:extend", ({ config }) => fn(config));
1177
1207
  }
1178
1208
  function addWebpackPlugin(pluginOrGetter, options) {
1179
- extendWebpackConfig((config) => {
1209
+ extendWebpackConfig(async (config) => {
1180
1210
  const method = options?.prepend ? "unshift" : "push";
1181
- const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
1211
+ const plugin = typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter;
1182
1212
  config.plugins ||= [];
1183
1213
  config.plugins[method](...toArray(plugin));
1184
1214
  }, options);
1185
1215
  }
1186
1216
  function addRspackPlugin(pluginOrGetter, options) {
1187
- extendRspackConfig((config) => {
1217
+ extendRspackConfig(async (config) => {
1188
1218
  const method = options?.prepend ? "unshift" : "push";
1189
- const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
1219
+ const plugin = typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter;
1190
1220
  config.plugins ||= [];
1191
1221
  config.plugins[method](...toArray(plugin));
1192
1222
  }, options);
@@ -1200,9 +1230,9 @@ function addVitePlugin(pluginOrGetter, options = {}) {
1200
1230
  return;
1201
1231
  }
1202
1232
  let needsEnvInjection = false;
1203
- nuxt.hook("vite:extend", ({ config }) => {
1233
+ nuxt.hook("vite:extend", async ({ config }) => {
1204
1234
  config.plugins ||= [];
1205
- const plugin = toArray(typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter);
1235
+ const plugin = toArray(typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter);
1206
1236
  if (options.server !== false && options.client !== false) {
1207
1237
  const method = options?.prepend ? "unshift" : "push";
1208
1238
  config.plugins[method](...plugin);
@@ -1224,11 +1254,11 @@ function addVitePlugin(pluginOrGetter, options = {}) {
1224
1254
  }
1225
1255
  });
1226
1256
  });
1227
- nuxt.hook("vite:extendConfig", (config, env) => {
1257
+ nuxt.hook("vite:extendConfig", async (config, env) => {
1228
1258
  if (!needsEnvInjection) {
1229
1259
  return;
1230
1260
  }
1231
- const plugin = toArray(typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter);
1261
+ const plugin = toArray(typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter);
1232
1262
  const method = options?.prepend ? "unshift" : "push";
1233
1263
  if (env.isClient && options.server === false) {
1234
1264
  config.plugins[method](...plugin);
@@ -1426,6 +1456,8 @@ function resolveLayerPaths(dirs, projectBuildDir) {
1426
1456
  nuxt: [
1427
1457
  join(relativeSrcDir, "**/*"),
1428
1458
  join(relativeModulesDir, `*/runtime/**/*`),
1459
+ join(relativeRootDir, `test/nuxt/**/*`),
1460
+ join(relativeRootDir, `tests/nuxt/**/*`),
1429
1461
  join(relativeRootDir, `layers/*/app/**/*`),
1430
1462
  join(relativeRootDir, `layers/*/modules/*/runtime/**/*`)
1431
1463
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit-nightly",
3
- "version": "4.3.0-29356103.2f7957ac",
3
+ "version": "4.3.0-29430576.f48ea4c8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -23,12 +23,12 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "c12": "^3.3.1",
26
+ "c12": "^3.3.2",
27
27
  "consola": "^3.4.2",
28
28
  "defu": "^6.1.4",
29
29
  "destr": "^2.0.5",
30
30
  "errx": "^0.1.0",
31
- "exsolve": "^1.0.7",
31
+ "exsolve": "^1.0.8",
32
32
  "ignore": "^7.0.5",
33
33
  "jiti": "^2.6.1",
34
34
  "klona": "^2.0.6",
@@ -45,22 +45,23 @@
45
45
  "untyped": "^2.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29356103.2f7957ac",
49
- "@rspack/core": "1.5.8",
48
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29430576.f48ea4c8",
49
+ "@rspack/core": "1.6.7",
50
50
  "@types/semver": "7.7.1",
51
51
  "hookable": "5.5.3",
52
- "nitropack": "2.12.8",
52
+ "nitropack": "2.12.9",
53
53
  "unbuild": "3.6.1",
54
54
  "unimport": "5.5.0",
55
- "vite": "7.1.12",
55
+ "vite": "7.2.7",
56
56
  "vitest": "3.2.4",
57
- "webpack": "5.102.1"
57
+ "webpack": "5.103.0"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=18.12.0"
61
61
  },
62
62
  "_name": "@nuxt/kit",
63
63
  "scripts": {
64
+ "build:stub": "unbuild --stub",
64
65
  "test:attw": "attw --pack"
65
66
  }
66
67
  }