@nuxt/kit 3.20.2 → 3.21.0
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 +4 -2
- package/dist/index.d.mts +34 -24
- package/dist/index.d.ts +34 -24
- package/dist/index.mjs +72 -48
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
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
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
|
+
<a href="https://nuxt.com/modules"><img src="https://img.shields.io/badge/dynamic/json?url=https://nuxt.com/api/v1/modules&query=$.stats.modules&label=Modules&style=flat&colorA=18181B&colorB=28CF8D" alt="Modules"></a>
|
|
9
10
|
<a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt%20Docs-18181B?logo=nuxt" alt="Website"></a>
|
|
10
11
|
<a href="https://chat.nuxt.dev"><img src="https://img.shields.io/badge/Nuxt%20Discord-18181B?logo=discord" alt="Discord"></a>
|
|
11
12
|
<a href="https://securityscorecards.dev/"><img src="https://api.securityscorecards.dev/projects/github.com/nuxt/nuxt/badge" alt="Nuxt openssf scorecard score"></a>
|
|
13
|
+
<a href="https://deepwiki.com/nuxt/nuxt"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
|
|
12
14
|
</p>
|
|
13
15
|
|
|
14
16
|
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.
|
|
@@ -21,14 +23,14 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
|
|
|
21
23
|
- Auto imports of components, composables and utils
|
|
22
24
|
- TypeScript with zero configuration
|
|
23
25
|
- Go full-stack with our server/ directory
|
|
24
|
-
- Extensible with [
|
|
26
|
+
- Extensible with [300+ modules](https://nuxt.com/modules)
|
|
25
27
|
- Deployment to a variety of [hosting platforms](https://nuxt.com/deploy)
|
|
26
28
|
- ...[and much more](https://nuxt.com) 🚀
|
|
27
29
|
|
|
28
30
|
### Table of Contents
|
|
29
31
|
|
|
30
32
|
- 🚀 [Getting Started](#getting-started)
|
|
31
|
-
- 💻 [
|
|
33
|
+
- 💻 [Vue Development](#vue-development)
|
|
32
34
|
- 📖 [Documentation](#documentation)
|
|
33
35
|
- 🧩 [Modules](#modules)
|
|
34
36
|
- ❤️ [Contribute](#contribute)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
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
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
|
|
9
|
-
import
|
|
7
|
+
import { UseContext } from 'unctx';
|
|
8
|
+
import * as NitroV2 from 'nitropack/types';
|
|
9
|
+
import * as NitroV3 from 'nitro/types';
|
|
10
10
|
import { GlobOptions } from 'tinyglobby';
|
|
11
|
-
import
|
|
12
|
-
import { ConsolaOptions } from 'consola';
|
|
11
|
+
import { ConsolaInstance, ConsolaOptions } from 'consola';
|
|
13
12
|
import { genSafeVariableName } from 'knitwork';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -53,7 +52,7 @@ declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
|
53
52
|
*/
|
|
54
53
|
declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
|
|
55
54
|
/**
|
|
56
|
-
* Checks if a Nuxt
|
|
55
|
+
* Checks if a Nuxt module is compatible with a given semver version.
|
|
57
56
|
*/
|
|
58
57
|
declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
|
|
59
58
|
/**
|
|
@@ -116,7 +115,7 @@ interface LayerDirectories {
|
|
|
116
115
|
* @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
|
|
117
116
|
* @returns Array of LayerDirectories objects, ordered by priority (user layer first)
|
|
118
117
|
*/
|
|
119
|
-
declare function getLayerDirectories(nuxt?:
|
|
118
|
+
declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
|
|
120
119
|
|
|
121
120
|
declare function setGlobalHead(head: NuxtAppConfig['head']): void;
|
|
122
121
|
|
|
@@ -137,6 +136,8 @@ declare function useRuntimeConfig(): Record<string, any>;
|
|
|
137
136
|
*/
|
|
138
137
|
declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
|
|
139
138
|
|
|
139
|
+
type Arrayable<T> = T | T[];
|
|
140
|
+
type Thenable<T> = T | Promise<T>;
|
|
140
141
|
interface ExtendConfigOptions {
|
|
141
142
|
/**
|
|
142
143
|
* Install plugin on dev
|
|
@@ -183,40 +184,41 @@ interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, 'server' | '
|
|
|
183
184
|
*/
|
|
184
185
|
client?: boolean;
|
|
185
186
|
}
|
|
187
|
+
type ExtendWebpacklikeConfig = (fn: (config: Configuration) => void, options?: ExtendWebpackConfigOptions) => void;
|
|
186
188
|
/**
|
|
187
189
|
* Extend webpack config
|
|
188
190
|
*
|
|
189
191
|
* The fallback function might be called multiple times
|
|
190
192
|
* when applying to both client and server builds.
|
|
191
193
|
*/
|
|
192
|
-
declare const extendWebpackConfig:
|
|
194
|
+
declare const extendWebpackConfig: ExtendWebpacklikeConfig;
|
|
193
195
|
/**
|
|
194
196
|
* Extend rspack config
|
|
195
197
|
*
|
|
196
198
|
* The fallback function might be called multiple times
|
|
197
199
|
* when applying to both client and server builds.
|
|
198
200
|
*/
|
|
199
|
-
declare const extendRspackConfig:
|
|
201
|
+
declare const extendRspackConfig: ExtendWebpacklikeConfig;
|
|
200
202
|
/**
|
|
201
203
|
* Extend Vite config
|
|
202
204
|
*/
|
|
203
|
-
declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): (() => void) | undefined;
|
|
205
|
+
declare function extendViteConfig(fn: ((config: UserConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
|
|
204
206
|
/**
|
|
205
207
|
* Append webpack plugin to the config.
|
|
206
208
|
*/
|
|
207
|
-
declare function addWebpackPlugin(pluginOrGetter: WebpackPluginInstance |
|
|
209
|
+
declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
208
210
|
/**
|
|
209
211
|
* Append rspack plugin to the config.
|
|
210
212
|
*/
|
|
211
|
-
declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance |
|
|
213
|
+
declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackPluginInstance> | (() => Thenable<Arrayable<RspackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
212
214
|
/**
|
|
213
215
|
* Append Vite plugin to the config.
|
|
214
216
|
*/
|
|
215
|
-
declare function addVitePlugin(pluginOrGetter: Plugin |
|
|
217
|
+
declare function addVitePlugin(pluginOrGetter: Arrayable<Plugin> | (() => Thenable<Arrayable<Plugin>>), options?: ExtendConfigOptions): void;
|
|
216
218
|
interface AddBuildPluginFactory {
|
|
217
|
-
vite?: () => Plugin
|
|
218
|
-
webpack?: () => WebpackPluginInstance
|
|
219
|
-
rspack?: () => RspackPluginInstance
|
|
219
|
+
vite?: () => Thenable<Arrayable<Plugin>>;
|
|
220
|
+
webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
|
|
221
|
+
rspack?: () => Thenable<Arrayable<RspackPluginInstance>>;
|
|
220
222
|
}
|
|
221
223
|
declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
|
|
222
224
|
|
|
@@ -233,10 +235,11 @@ declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?:
|
|
|
233
235
|
* Check version constraints and return true if passed, otherwise returns false
|
|
234
236
|
*/
|
|
235
237
|
declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
|
|
238
|
+
type NuxtMajorVersion = 2 | 3 | 4;
|
|
236
239
|
/**
|
|
237
240
|
* Check if current Nuxt instance is of specified major version
|
|
238
241
|
*/
|
|
239
|
-
declare function isNuxtMajorVersion(majorVersion:
|
|
242
|
+
declare function isNuxtMajorVersion(majorVersion: NuxtMajorVersion, nuxt?: Nuxt): boolean;
|
|
240
243
|
/**
|
|
241
244
|
* @deprecated Use `isNuxtMajorVersion(2, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
242
245
|
*/
|
|
@@ -279,7 +282,7 @@ declare function addComponent(opts: AddComponentOptions): void;
|
|
|
279
282
|
* Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
|
|
280
283
|
* @deprecated Use `getNuxtCtx` instead
|
|
281
284
|
*/
|
|
282
|
-
declare const nuxtCtx:
|
|
285
|
+
declare const nuxtCtx: UseContext<Nuxt>;
|
|
283
286
|
/** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
|
|
284
287
|
declare const getNuxtCtx: () => Nuxt | null;
|
|
285
288
|
/**
|
|
@@ -307,15 +310,22 @@ declare function useNuxt(): Nuxt;
|
|
|
307
310
|
declare function tryUseNuxt(): Nuxt | null;
|
|
308
311
|
declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
|
|
309
312
|
|
|
310
|
-
declare function createIsIgnored(nuxt?:
|
|
313
|
+
declare function createIsIgnored(nuxt?: Nuxt | null | undefined): (pathname: string, stats?: unknown) => boolean;
|
|
311
314
|
/**
|
|
312
315
|
* Return a filter function to filter an array of paths
|
|
313
316
|
*/
|
|
314
|
-
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?:
|
|
317
|
+
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: Nuxt | null | undefined): boolean;
|
|
315
318
|
declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
316
319
|
|
|
317
320
|
declare function addLayout(this: any, template: NuxtTemplate | string, name?: string): void;
|
|
318
321
|
|
|
322
|
+
type isNitroV2 = 'options' extends keyof NitroV2.Nitro ? '___INVALID' extends keyof NitroV2.Nitro ? false : true : false;
|
|
323
|
+
type isNitroV3 = 'options' extends keyof NitroV3.Nitro ? '___INVALID' extends keyof NitroV3.Nitro ? false : true : false;
|
|
324
|
+
type Nitro = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.Nitro | NitroV3.Nitro : NitroV2.Nitro : NitroV3.Nitro;
|
|
325
|
+
type NitroDevEventHandler = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroDevEventHandler | NitroV3.NitroDevEventHandler : NitroV2.NitroDevEventHandler : NitroV3.NitroDevEventHandler;
|
|
326
|
+
type NitroEventHandler = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroEventHandler | NitroV3.NitroEventHandler : NitroV2.NitroEventHandler : NitroV3.NitroEventHandler;
|
|
327
|
+
type NitroRouteConfig = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroRouteConfig | NitroV3.NitroRouteConfig : NitroV2.NitroRouteConfig : NitroV3.NitroRouteConfig;
|
|
328
|
+
|
|
319
329
|
declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
320
330
|
interface ExtendRouteRulesOptions {
|
|
321
331
|
/**
|
|
@@ -516,11 +526,11 @@ declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildD
|
|
|
516
526
|
*/
|
|
517
527
|
declare function updateTemplates(options?: {
|
|
518
528
|
filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
|
|
519
|
-
}): Promise<
|
|
529
|
+
}): Promise<void>;
|
|
520
530
|
declare function writeTypes(nuxt: Nuxt): Promise<void>;
|
|
521
531
|
|
|
522
|
-
declare const logger:
|
|
523
|
-
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>):
|
|
532
|
+
declare const logger: ConsolaInstance;
|
|
533
|
+
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
|
|
524
534
|
|
|
525
535
|
interface ResolveModuleOptions {
|
|
526
536
|
/** @deprecated use `url` with URLs pointing at a file - never a directory */
|
|
@@ -567,4 +577,4 @@ declare const templateUtils: {
|
|
|
567
577
|
};
|
|
568
578
|
|
|
569
579
|
export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, runWithNuxtContext, setGlobalHead, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
570
|
-
export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LayerDirectories, LoadNuxtConfigOptions, LoadNuxtOptions, ResolveModuleOptions, ResolvePathOptions, Resolver };
|
|
580
|
+
export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LayerDirectories, LoadNuxtConfigOptions, LoadNuxtOptions, NuxtMajorVersion, ResolveModuleOptions, ResolvePathOptions, Resolver };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
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
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
|
|
9
|
-
import
|
|
7
|
+
import { UseContext } from 'unctx';
|
|
8
|
+
import * as NitroV2 from 'nitropack/types';
|
|
9
|
+
import * as NitroV3 from 'nitro/types';
|
|
10
10
|
import { GlobOptions } from 'tinyglobby';
|
|
11
|
-
import
|
|
12
|
-
import { ConsolaOptions } from 'consola';
|
|
11
|
+
import { ConsolaInstance, ConsolaOptions } from 'consola';
|
|
13
12
|
import { genSafeVariableName } from 'knitwork';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -53,7 +52,7 @@ declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
|
53
52
|
*/
|
|
54
53
|
declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
|
|
55
54
|
/**
|
|
56
|
-
* Checks if a Nuxt
|
|
55
|
+
* Checks if a Nuxt module is compatible with a given semver version.
|
|
57
56
|
*/
|
|
58
57
|
declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
|
|
59
58
|
/**
|
|
@@ -116,7 +115,7 @@ interface LayerDirectories {
|
|
|
116
115
|
* @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
|
|
117
116
|
* @returns Array of LayerDirectories objects, ordered by priority (user layer first)
|
|
118
117
|
*/
|
|
119
|
-
declare function getLayerDirectories(nuxt?:
|
|
118
|
+
declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
|
|
120
119
|
|
|
121
120
|
declare function setGlobalHead(head: NuxtAppConfig['head']): void;
|
|
122
121
|
|
|
@@ -137,6 +136,8 @@ declare function useRuntimeConfig(): Record<string, any>;
|
|
|
137
136
|
*/
|
|
138
137
|
declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
|
|
139
138
|
|
|
139
|
+
type Arrayable<T> = T | T[];
|
|
140
|
+
type Thenable<T> = T | Promise<T>;
|
|
140
141
|
interface ExtendConfigOptions {
|
|
141
142
|
/**
|
|
142
143
|
* Install plugin on dev
|
|
@@ -183,40 +184,41 @@ interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, 'server' | '
|
|
|
183
184
|
*/
|
|
184
185
|
client?: boolean;
|
|
185
186
|
}
|
|
187
|
+
type ExtendWebpacklikeConfig = (fn: (config: Configuration) => void, options?: ExtendWebpackConfigOptions) => void;
|
|
186
188
|
/**
|
|
187
189
|
* Extend webpack config
|
|
188
190
|
*
|
|
189
191
|
* The fallback function might be called multiple times
|
|
190
192
|
* when applying to both client and server builds.
|
|
191
193
|
*/
|
|
192
|
-
declare const extendWebpackConfig:
|
|
194
|
+
declare const extendWebpackConfig: ExtendWebpacklikeConfig;
|
|
193
195
|
/**
|
|
194
196
|
* Extend rspack config
|
|
195
197
|
*
|
|
196
198
|
* The fallback function might be called multiple times
|
|
197
199
|
* when applying to both client and server builds.
|
|
198
200
|
*/
|
|
199
|
-
declare const extendRspackConfig:
|
|
201
|
+
declare const extendRspackConfig: ExtendWebpacklikeConfig;
|
|
200
202
|
/**
|
|
201
203
|
* Extend Vite config
|
|
202
204
|
*/
|
|
203
|
-
declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): (() => void) | undefined;
|
|
205
|
+
declare function extendViteConfig(fn: ((config: UserConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
|
|
204
206
|
/**
|
|
205
207
|
* Append webpack plugin to the config.
|
|
206
208
|
*/
|
|
207
|
-
declare function addWebpackPlugin(pluginOrGetter: WebpackPluginInstance |
|
|
209
|
+
declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
208
210
|
/**
|
|
209
211
|
* Append rspack plugin to the config.
|
|
210
212
|
*/
|
|
211
|
-
declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance |
|
|
213
|
+
declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackPluginInstance> | (() => Thenable<Arrayable<RspackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
212
214
|
/**
|
|
213
215
|
* Append Vite plugin to the config.
|
|
214
216
|
*/
|
|
215
|
-
declare function addVitePlugin(pluginOrGetter: Plugin |
|
|
217
|
+
declare function addVitePlugin(pluginOrGetter: Arrayable<Plugin> | (() => Thenable<Arrayable<Plugin>>), options?: ExtendConfigOptions): void;
|
|
216
218
|
interface AddBuildPluginFactory {
|
|
217
|
-
vite?: () => Plugin
|
|
218
|
-
webpack?: () => WebpackPluginInstance
|
|
219
|
-
rspack?: () => RspackPluginInstance
|
|
219
|
+
vite?: () => Thenable<Arrayable<Plugin>>;
|
|
220
|
+
webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
|
|
221
|
+
rspack?: () => Thenable<Arrayable<RspackPluginInstance>>;
|
|
220
222
|
}
|
|
221
223
|
declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
|
|
222
224
|
|
|
@@ -233,10 +235,11 @@ declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?:
|
|
|
233
235
|
* Check version constraints and return true if passed, otherwise returns false
|
|
234
236
|
*/
|
|
235
237
|
declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
|
|
238
|
+
type NuxtMajorVersion = 2 | 3 | 4;
|
|
236
239
|
/**
|
|
237
240
|
* Check if current Nuxt instance is of specified major version
|
|
238
241
|
*/
|
|
239
|
-
declare function isNuxtMajorVersion(majorVersion:
|
|
242
|
+
declare function isNuxtMajorVersion(majorVersion: NuxtMajorVersion, nuxt?: Nuxt): boolean;
|
|
240
243
|
/**
|
|
241
244
|
* @deprecated Use `isNuxtMajorVersion(2, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
242
245
|
*/
|
|
@@ -279,7 +282,7 @@ declare function addComponent(opts: AddComponentOptions): void;
|
|
|
279
282
|
* Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
|
|
280
283
|
* @deprecated Use `getNuxtCtx` instead
|
|
281
284
|
*/
|
|
282
|
-
declare const nuxtCtx:
|
|
285
|
+
declare const nuxtCtx: UseContext<Nuxt>;
|
|
283
286
|
/** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
|
|
284
287
|
declare const getNuxtCtx: () => Nuxt | null;
|
|
285
288
|
/**
|
|
@@ -307,15 +310,22 @@ declare function useNuxt(): Nuxt;
|
|
|
307
310
|
declare function tryUseNuxt(): Nuxt | null;
|
|
308
311
|
declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
|
|
309
312
|
|
|
310
|
-
declare function createIsIgnored(nuxt?:
|
|
313
|
+
declare function createIsIgnored(nuxt?: Nuxt | null | undefined): (pathname: string, stats?: unknown) => boolean;
|
|
311
314
|
/**
|
|
312
315
|
* Return a filter function to filter an array of paths
|
|
313
316
|
*/
|
|
314
|
-
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?:
|
|
317
|
+
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: Nuxt | null | undefined): boolean;
|
|
315
318
|
declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
316
319
|
|
|
317
320
|
declare function addLayout(this: any, template: NuxtTemplate | string, name?: string): void;
|
|
318
321
|
|
|
322
|
+
type isNitroV2 = 'options' extends keyof NitroV2.Nitro ? '___INVALID' extends keyof NitroV2.Nitro ? false : true : false;
|
|
323
|
+
type isNitroV3 = 'options' extends keyof NitroV3.Nitro ? '___INVALID' extends keyof NitroV3.Nitro ? false : true : false;
|
|
324
|
+
type Nitro = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.Nitro | NitroV3.Nitro : NitroV2.Nitro : NitroV3.Nitro;
|
|
325
|
+
type NitroDevEventHandler = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroDevEventHandler | NitroV3.NitroDevEventHandler : NitroV2.NitroDevEventHandler : NitroV3.NitroDevEventHandler;
|
|
326
|
+
type NitroEventHandler = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroEventHandler | NitroV3.NitroEventHandler : NitroV2.NitroEventHandler : NitroV3.NitroEventHandler;
|
|
327
|
+
type NitroRouteConfig = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroRouteConfig | NitroV3.NitroRouteConfig : NitroV2.NitroRouteConfig : NitroV3.NitroRouteConfig;
|
|
328
|
+
|
|
319
329
|
declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
320
330
|
interface ExtendRouteRulesOptions {
|
|
321
331
|
/**
|
|
@@ -516,11 +526,11 @@ declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildD
|
|
|
516
526
|
*/
|
|
517
527
|
declare function updateTemplates(options?: {
|
|
518
528
|
filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
|
|
519
|
-
}): Promise<
|
|
529
|
+
}): Promise<void>;
|
|
520
530
|
declare function writeTypes(nuxt: Nuxt): Promise<void>;
|
|
521
531
|
|
|
522
|
-
declare const logger:
|
|
523
|
-
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>):
|
|
532
|
+
declare const logger: ConsolaInstance;
|
|
533
|
+
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
|
|
524
534
|
|
|
525
535
|
interface ResolveModuleOptions {
|
|
526
536
|
/** @deprecated use `url` with URLs pointing at a file - never a directory */
|
|
@@ -567,4 +577,4 @@ declare const templateUtils: {
|
|
|
567
577
|
};
|
|
568
578
|
|
|
569
579
|
export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, runWithNuxtContext, setGlobalHead, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
570
|
-
export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LayerDirectories, LoadNuxtConfigOptions, LoadNuxtOptions, ResolveModuleOptions, ResolvePathOptions, Resolver };
|
|
580
|
+
export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LayerDirectories, LoadNuxtConfigOptions, LoadNuxtOptions, NuxtMajorVersion, ResolveModuleOptions, ResolvePathOptions, Resolver };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises, existsSync, readFileSync, lstatSync } from 'node:fs';
|
|
2
2
|
import { performance } from 'node:perf_hooks';
|
|
3
|
-
import
|
|
3
|
+
import { defu } from 'defu';
|
|
4
4
|
import { applyDefaults } from 'untyped';
|
|
5
5
|
import { dirname, resolve, relative, join, normalize, isAbsolute, basename, parse } from 'pathe';
|
|
6
6
|
import { consola } from 'consola';
|
|
@@ -13,7 +13,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
13
13
|
import { createJiti } from 'jiti';
|
|
14
14
|
import { parseNodeModulePath, interopDefault, lookupNodeModuleSubpath, resolveModuleExportNames } from 'mlly';
|
|
15
15
|
import { resolveModulePath, resolveModuleURL } from 'exsolve';
|
|
16
|
-
import { isRelative, withTrailingSlash as withTrailingSlash$2 } from 'ufo';
|
|
16
|
+
import { isRelative, withTrailingSlash as withTrailingSlash$2, withoutTrailingSlash } from 'ufo';
|
|
17
17
|
import { read, update } from 'rc9';
|
|
18
18
|
import semver, { gte } from 'semver';
|
|
19
19
|
import { captureStackTrace } from 'errx';
|
|
@@ -2565,6 +2565,7 @@ function tryRequireModule(id, opts) {
|
|
|
2565
2565
|
}
|
|
2566
2566
|
|
|
2567
2567
|
const NODE_MODULES_RE = /[/\\]node_modules[/\\]/;
|
|
2568
|
+
const ignoredConfigKeys = /* @__PURE__ */ new Set(["components", "imports", "pages", "devtools", "telemetry"]);
|
|
2568
2569
|
async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useNuxt()) {
|
|
2569
2570
|
const localLayerModuleDirs = [];
|
|
2570
2571
|
for (const l of nuxt.options._layers) {
|
|
@@ -2587,7 +2588,7 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
|
|
|
2587
2588
|
}
|
|
2588
2589
|
throw err;
|
|
2589
2590
|
});
|
|
2590
|
-
const dependencyMeta = res.nuxtModule.getModuleDependencies?.(nuxt) || {};
|
|
2591
|
+
const dependencyMeta = await res.nuxtModule.getModuleDependencies?.(nuxt) || {};
|
|
2591
2592
|
for (const [name, value] of Object.entries(dependencyMeta)) {
|
|
2592
2593
|
if (!value.overrides && !value.defaults && !value.version && value.optional) {
|
|
2593
2594
|
continue;
|
|
@@ -2642,8 +2643,8 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
|
|
|
2642
2643
|
if (error) {
|
|
2643
2644
|
throw error;
|
|
2644
2645
|
}
|
|
2645
|
-
for (const { nuxtModule, meta, moduleToInstall, buildTimeModuleMeta, resolvedModulePath, inlineOptions } of resolvedModules) {
|
|
2646
|
-
const configKey = meta
|
|
2646
|
+
for (const { nuxtModule, meta = {}, moduleToInstall, buildTimeModuleMeta, resolvedModulePath, inlineOptions: inlineOptions2 } of resolvedModules) {
|
|
2647
|
+
const configKey = meta.configKey;
|
|
2647
2648
|
const optionsFns = [
|
|
2648
2649
|
...nuxt._moduleOptionsFunctions.get(moduleToInstall) || [],
|
|
2649
2650
|
...meta?.name ? nuxt._moduleOptionsFunctions.get(meta.name) || [] : [],
|
|
@@ -2662,12 +2663,21 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
|
|
|
2662
2663
|
nuxt.options[configKey] = defu(...overrides, nuxt.options[configKey], ...defaults);
|
|
2663
2664
|
}
|
|
2664
2665
|
}
|
|
2665
|
-
|
|
2666
|
-
|
|
2666
|
+
const isDisabled = configKey && !ignoredConfigKeys.has(configKey) && nuxt.options[configKey] === false;
|
|
2667
|
+
if (!isDisabled) {
|
|
2668
|
+
await callLifecycleHooks(nuxtModule, meta, inlineOptions2, nuxt);
|
|
2669
|
+
}
|
|
2670
|
+
const path = typeof moduleToInstall === "string" ? moduleToInstall : void 0;
|
|
2671
|
+
await callModule(nuxt, nuxtModule, inlineOptions2, {
|
|
2672
|
+
meta: defu({ disabled: isDisabled }, meta, buildTimeModuleMeta),
|
|
2673
|
+
nameOrPath: path,
|
|
2674
|
+
modulePath: resolvedModulePath || path,
|
|
2675
|
+
localLayerModuleDirs
|
|
2676
|
+
});
|
|
2667
2677
|
}
|
|
2668
2678
|
delete nuxt._moduleOptionsFunctions;
|
|
2669
2679
|
}
|
|
2670
|
-
async function installModule(moduleToInstall,
|
|
2680
|
+
async function installModule(moduleToInstall, inlineOptions2, nuxt = useNuxt()) {
|
|
2671
2681
|
const { nuxtModule, buildTimeModuleMeta, resolvedModulePath } = await loadNuxtModuleInstance(moduleToInstall, nuxt);
|
|
2672
2682
|
const localLayerModuleDirs = [];
|
|
2673
2683
|
for (const dirs of getLayerDirectories(nuxt)) {
|
|
@@ -2676,7 +2686,7 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
|
2676
2686
|
}
|
|
2677
2687
|
}
|
|
2678
2688
|
const meta = await nuxtModule.getMeta?.();
|
|
2679
|
-
let mergedOptions =
|
|
2689
|
+
let mergedOptions = inlineOptions2;
|
|
2680
2690
|
const configKey = meta?.configKey;
|
|
2681
2691
|
if (configKey && nuxt._moduleOptionsFunctions) {
|
|
2682
2692
|
const optionsFns = [
|
|
@@ -2691,12 +2701,21 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
|
2691
2701
|
overrides.push(options.overrides);
|
|
2692
2702
|
defaults.push(options.defaults);
|
|
2693
2703
|
}
|
|
2694
|
-
mergedOptions = defu(
|
|
2704
|
+
mergedOptions = defu(inlineOptions2, ...overrides, nuxt.options[configKey], ...defaults);
|
|
2695
2705
|
nuxt.options[configKey] = mergedOptions;
|
|
2696
2706
|
}
|
|
2697
2707
|
}
|
|
2698
|
-
|
|
2699
|
-
|
|
2708
|
+
const isDisabled = configKey && !ignoredConfigKeys.has(configKey) && nuxt.options[configKey] === false;
|
|
2709
|
+
if (!isDisabled) {
|
|
2710
|
+
await callLifecycleHooks(nuxtModule, meta, mergedOptions, nuxt);
|
|
2711
|
+
}
|
|
2712
|
+
const path = typeof moduleToInstall === "string" ? moduleToInstall : void 0;
|
|
2713
|
+
await callModule(nuxt, nuxtModule, mergedOptions, {
|
|
2714
|
+
meta: defu({ disabled: isDisabled }, meta, buildTimeModuleMeta),
|
|
2715
|
+
nameOrPath: path,
|
|
2716
|
+
modulePath: resolvedModulePath || path,
|
|
2717
|
+
localLayerModuleDirs
|
|
2718
|
+
});
|
|
2700
2719
|
}
|
|
2701
2720
|
function resolveModuleWithOptions(definition, nuxt) {
|
|
2702
2721
|
const [module, options = {}] = Array.isArray(definition) ? definition : [definition, {}];
|
|
@@ -2779,7 +2798,7 @@ const normalizeModuleTranspilePath = (p) => {
|
|
|
2779
2798
|
return getDirectory(p).split("node_modules/").pop();
|
|
2780
2799
|
};
|
|
2781
2800
|
const MissingModuleMatcher = /Cannot find module\s+['"]?([^'")\s]+)['"]?/i;
|
|
2782
|
-
async function callLifecycleHooks(nuxtModule, meta = {},
|
|
2801
|
+
async function callLifecycleHooks(nuxtModule, meta = {}, inlineOptions2, nuxt = useNuxt()) {
|
|
2783
2802
|
if (!meta.name || !meta.version) {
|
|
2784
2803
|
return;
|
|
2785
2804
|
}
|
|
@@ -2792,7 +2811,7 @@ async function callLifecycleHooks(nuxtModule, meta = {}, inlineOptions, nuxt = u
|
|
|
2792
2811
|
if (!previousVersion) {
|
|
2793
2812
|
await nuxtModule.onInstall?.(nuxt);
|
|
2794
2813
|
} else if (semver.gt(meta.version, previousVersion)) {
|
|
2795
|
-
await nuxtModule.onUpgrade?.(
|
|
2814
|
+
await nuxtModule.onUpgrade?.(nuxt, inlineOptions2, previousVersion);
|
|
2796
2815
|
}
|
|
2797
2816
|
if (previousVersion !== meta.version) {
|
|
2798
2817
|
update(
|
|
@@ -2806,12 +2825,12 @@ async function callLifecycleHooks(nuxtModule, meta = {}, inlineOptions, nuxt = u
|
|
|
2806
2825
|
);
|
|
2807
2826
|
}
|
|
2808
2827
|
}
|
|
2809
|
-
async function callModule(nuxtModule,
|
|
2810
|
-
const
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
const
|
|
2828
|
+
async function callModule(nuxt, nuxtModule, moduleOptions = {}, options) {
|
|
2829
|
+
const modulePath = options.modulePath;
|
|
2830
|
+
const nameOrPath = options.nameOrPath;
|
|
2831
|
+
const localLayerModuleDirs = options.localLayerModuleDirs;
|
|
2832
|
+
const fn = () => isNuxtMajorVersion(2, nuxt) ? nuxtModule.call(nuxt.moduleContainer, inlineOptions, nuxt) : nuxt.options.experimental?.debugModuleMutation && nuxt._asyncLocalStorageModule ? nuxt._asyncLocalStorageModule.run(nuxtModule, () => nuxtModule(moduleOptions, nuxt)) : nuxtModule(moduleOptions, nuxt);
|
|
2833
|
+
const res = options.meta.disabled ? false : await fn();
|
|
2815
2834
|
let entryPath;
|
|
2816
2835
|
if (typeof modulePath === "string") {
|
|
2817
2836
|
const parsed = parseNodeModulePath(modulePath);
|
|
@@ -2819,22 +2838,26 @@ async function callModule(nuxtModule, meta = {}, inlineOptions, resolvedModulePa
|
|
|
2819
2838
|
const subpath = await lookupNodeModuleSubpath(modulePath) || ".";
|
|
2820
2839
|
entryPath = join(parsed.name, subpath === "./" ? "." : subpath);
|
|
2821
2840
|
}
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2841
|
+
if (res !== false) {
|
|
2842
|
+
const moduleRoot = parsed.dir ? parsed.dir + parsed.name : await resolvePackageJSON(modulePath, { try: true }).then((r) => r ? dirname(r) : modulePath);
|
|
2843
|
+
nuxt.options.build.transpile.push(normalizeModuleTranspilePath(moduleRoot));
|
|
2844
|
+
const directory = moduleRoot.replace(/\/?$/, "/");
|
|
2845
|
+
if (moduleRoot !== nameOrPath && !localLayerModuleDirs.some((dir) => directory.startsWith(dir))) {
|
|
2846
|
+
nuxt.options.modulesDir.push(join(moduleRoot, "node_modules"));
|
|
2847
|
+
}
|
|
2827
2848
|
}
|
|
2828
2849
|
}
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2850
|
+
if (nameOrPath) {
|
|
2851
|
+
entryPath ||= resolveAlias(nameOrPath, nuxt.options.alias);
|
|
2852
|
+
if (entryPath !== nameOrPath) {
|
|
2853
|
+
options.meta.rawPath = nameOrPath;
|
|
2854
|
+
}
|
|
2833
2855
|
}
|
|
2856
|
+
nuxt.options._installedModules ||= [];
|
|
2834
2857
|
nuxt.options._installedModules.push({
|
|
2835
|
-
meta:
|
|
2858
|
+
meta: options.meta,
|
|
2836
2859
|
module: nuxtModule,
|
|
2837
|
-
timings: res.timings,
|
|
2860
|
+
timings: (res || {}).timings,
|
|
2838
2861
|
entryPath
|
|
2839
2862
|
});
|
|
2840
2863
|
}
|
|
@@ -2885,8 +2908,8 @@ async function loadNuxtConfig(opts) {
|
|
|
2885
2908
|
const localLayers = (await glob("layers/*", {
|
|
2886
2909
|
onlyDirectories: true,
|
|
2887
2910
|
cwd: opts.cwd || process.cwd()
|
|
2888
|
-
})).map((d) =>
|
|
2889
|
-
opts.overrides = defu
|
|
2911
|
+
})).map((d) => withTrailingSlash$2(d)).sort((a, b) => b.localeCompare(a));
|
|
2912
|
+
opts.overrides = defu(opts.overrides, { _extends: localLayers });
|
|
2890
2913
|
const { configFile, layers = [], cwd, config: nuxtConfig, meta } = await withDefineNuxtConfig(
|
|
2891
2914
|
() => loadConfig({
|
|
2892
2915
|
name: "nuxt",
|
|
@@ -2921,7 +2944,7 @@ async function loadNuxtConfig(opts) {
|
|
|
2921
2944
|
}
|
|
2922
2945
|
const _layers = [];
|
|
2923
2946
|
const processedLayers = /* @__PURE__ */ new Set();
|
|
2924
|
-
const localRelativePaths = new Set(localLayers);
|
|
2947
|
+
const localRelativePaths = new Set(localLayers.map((layer) => withoutTrailingSlash(layer)));
|
|
2925
2948
|
for (const layer of layers) {
|
|
2926
2949
|
const resolvedRootDir = layer.config?.rootDir ?? layer.cwd;
|
|
2927
2950
|
layer.config = {
|
|
@@ -3075,7 +3098,7 @@ const HANDLER_METHOD_RE = /\.(get|head|patch|post|put|delete|connect|options|tra
|
|
|
3075
3098
|
function normalizeHandlerMethod(handler) {
|
|
3076
3099
|
const [, method = void 0] = handler.handler.match(HANDLER_METHOD_RE) || [];
|
|
3077
3100
|
return {
|
|
3078
|
-
method,
|
|
3101
|
+
method: method?.toUpperCase(),
|
|
3079
3102
|
...handler,
|
|
3080
3103
|
handler: normalize(handler.handler)
|
|
3081
3104
|
};
|
|
@@ -3148,7 +3171,7 @@ function useRuntimeConfig() {
|
|
|
3148
3171
|
}
|
|
3149
3172
|
function updateRuntimeConfig(runtimeConfig) {
|
|
3150
3173
|
const nuxt = useNuxt();
|
|
3151
|
-
Object.assign(nuxt.options.nitro.runtimeConfig, defu
|
|
3174
|
+
Object.assign(nuxt.options.nitro.runtimeConfig, defu(runtimeConfig, nuxt.options.nitro.runtimeConfig));
|
|
3152
3175
|
try {
|
|
3153
3176
|
return useNitro().updateConfig({ runtimeConfig });
|
|
3154
3177
|
} catch {
|
|
@@ -3200,17 +3223,17 @@ const extendWebpackCompatibleConfig = (builder) => (fn, options = {}) => {
|
|
|
3200
3223
|
if (options.build === false && nuxt.options.build) {
|
|
3201
3224
|
return;
|
|
3202
3225
|
}
|
|
3203
|
-
nuxt.hook(`${builder}:config`, (configs) => {
|
|
3226
|
+
nuxt.hook(`${builder}:config`, async (configs) => {
|
|
3204
3227
|
if (options.server !== false) {
|
|
3205
3228
|
const config = configs.find((i) => i.name === "server");
|
|
3206
3229
|
if (config) {
|
|
3207
|
-
fn(config);
|
|
3230
|
+
await fn(config);
|
|
3208
3231
|
}
|
|
3209
3232
|
}
|
|
3210
3233
|
if (options.client !== false) {
|
|
3211
3234
|
const config = configs.find((i) => i.name === "client");
|
|
3212
3235
|
if (config) {
|
|
3213
|
-
fn(config);
|
|
3236
|
+
await fn(config);
|
|
3214
3237
|
}
|
|
3215
3238
|
}
|
|
3216
3239
|
});
|
|
@@ -3234,17 +3257,17 @@ function extendViteConfig(fn, options = {}) {
|
|
|
3234
3257
|
return nuxt.hook("vite:extend", ({ config }) => fn(config));
|
|
3235
3258
|
}
|
|
3236
3259
|
function addWebpackPlugin(pluginOrGetter, options) {
|
|
3237
|
-
extendWebpackConfig((config) => {
|
|
3260
|
+
extendWebpackConfig(async (config) => {
|
|
3238
3261
|
const method = options?.prepend ? "unshift" : "push";
|
|
3239
|
-
const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
|
|
3262
|
+
const plugin = typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter;
|
|
3240
3263
|
config.plugins ||= [];
|
|
3241
3264
|
config.plugins[method](...toArray(plugin));
|
|
3242
3265
|
}, options);
|
|
3243
3266
|
}
|
|
3244
3267
|
function addRspackPlugin(pluginOrGetter, options) {
|
|
3245
|
-
extendRspackConfig((config) => {
|
|
3268
|
+
extendRspackConfig(async (config) => {
|
|
3246
3269
|
const method = options?.prepend ? "unshift" : "push";
|
|
3247
|
-
const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
|
|
3270
|
+
const plugin = typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter;
|
|
3248
3271
|
config.plugins ||= [];
|
|
3249
3272
|
config.plugins[method](...toArray(plugin));
|
|
3250
3273
|
}, options);
|
|
@@ -3258,9 +3281,9 @@ function addVitePlugin(pluginOrGetter, options = {}) {
|
|
|
3258
3281
|
return;
|
|
3259
3282
|
}
|
|
3260
3283
|
let needsEnvInjection = false;
|
|
3261
|
-
nuxt.hook("vite:extend", ({ config }) => {
|
|
3284
|
+
nuxt.hook("vite:extend", async ({ config }) => {
|
|
3262
3285
|
config.plugins ||= [];
|
|
3263
|
-
const plugin = toArray(typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter);
|
|
3286
|
+
const plugin = toArray(typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter);
|
|
3264
3287
|
if (options.server !== false && options.client !== false) {
|
|
3265
3288
|
const method = options?.prepend ? "unshift" : "push";
|
|
3266
3289
|
config.plugins[method](...plugin);
|
|
@@ -3282,11 +3305,11 @@ function addVitePlugin(pluginOrGetter, options = {}) {
|
|
|
3282
3305
|
}
|
|
3283
3306
|
});
|
|
3284
3307
|
});
|
|
3285
|
-
nuxt.hook("vite:extendConfig", (config, env) => {
|
|
3308
|
+
nuxt.hook("vite:extendConfig", async (config, env) => {
|
|
3286
3309
|
if (!needsEnvInjection) {
|
|
3287
3310
|
return;
|
|
3288
3311
|
}
|
|
3289
|
-
const plugin = toArray(typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter);
|
|
3312
|
+
const plugin = toArray(typeof pluginOrGetter === "function" ? await pluginOrGetter() : pluginOrGetter);
|
|
3290
3313
|
const method = options?.prepend ? "unshift" : "push";
|
|
3291
3314
|
if (env.isClient && options.server === false) {
|
|
3292
3315
|
config.plugins[method](...plugin);
|
|
@@ -3350,7 +3373,7 @@ function addComponents(addedComponents) {
|
|
|
3350
3373
|
const existingPriority = existingComponent.priority ?? 0;
|
|
3351
3374
|
const newPriority = component.priority ?? 0;
|
|
3352
3375
|
if (newPriority < existingPriority) {
|
|
3353
|
-
|
|
3376
|
+
continue;
|
|
3354
3377
|
}
|
|
3355
3378
|
if (newPriority === existingPriority) {
|
|
3356
3379
|
const name = existingComponent.pascalName || existingComponent.kebabName;
|
|
@@ -3539,6 +3562,7 @@ async function _generateTypes(nuxt) {
|
|
|
3539
3562
|
moduleDetection: "force",
|
|
3540
3563
|
isolatedModules: true,
|
|
3541
3564
|
verbatimModuleSyntax: true,
|
|
3565
|
+
allowArbitraryExtensions: true,
|
|
3542
3566
|
/* Strictness */
|
|
3543
3567
|
strict: nuxt.options.typescript?.strict ?? true,
|
|
3544
3568
|
noUncheckedIndexedAccess: isV4,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"c12": "^3.3.
|
|
26
|
+
"c12": "^3.3.3",
|
|
27
27
|
"consola": "^3.4.2",
|
|
28
28
|
"defu": "^6.1.4",
|
|
29
29
|
"destr": "^2.0.5",
|
|
@@ -41,28 +41,30 @@
|
|
|
41
41
|
"scule": "^1.3.0",
|
|
42
42
|
"semver": "^7.7.3",
|
|
43
43
|
"tinyglobby": "^0.2.15",
|
|
44
|
-
"ufo": "^1.6.
|
|
45
|
-
"unctx": "^2.
|
|
44
|
+
"ufo": "^1.6.3",
|
|
45
|
+
"unctx": "^2.5.0",
|
|
46
46
|
"untyped": "^2.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@rspack/core": "1.
|
|
49
|
+
"@rspack/core": "1.7.2",
|
|
50
50
|
"@types/lodash-es": "4.17.12",
|
|
51
51
|
"@types/semver": "7.7.1",
|
|
52
52
|
"hookable": "5.5.3",
|
|
53
|
-
"lodash-es": "4.17.
|
|
54
|
-
"
|
|
53
|
+
"lodash-es": "4.17.22",
|
|
54
|
+
"nitro": "3.0.1-alpha.1",
|
|
55
|
+
"nitropack": "2.13.1",
|
|
55
56
|
"unbuild": "3.6.1",
|
|
56
|
-
"unimport": "5.
|
|
57
|
-
"vite": "7.
|
|
57
|
+
"unimport": "5.6.0",
|
|
58
|
+
"vite": "7.3.1",
|
|
58
59
|
"vitest": "3.2.4",
|
|
59
|
-
"webpack": "5.
|
|
60
|
-
"@nuxt/schema": "3.
|
|
60
|
+
"webpack": "5.104.1",
|
|
61
|
+
"@nuxt/schema": "3.21.0"
|
|
61
62
|
},
|
|
62
63
|
"engines": {
|
|
63
64
|
"node": ">=18.12.0"
|
|
64
65
|
},
|
|
65
66
|
"scripts": {
|
|
67
|
+
"build:stub": "unbuild --stub",
|
|
66
68
|
"test:attw": "attw --pack"
|
|
67
69
|
}
|
|
68
70
|
}
|