@depup/nuxt__kit 4.4.2-depup.0 → 4.5.1-depup.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 +5 -4
- package/changes.json +8 -4
- package/dist/index.d.mts +1062 -270
- package/dist/index.mjs +1098 -131
- package/package.json +40 -36
package/dist/index.d.mts
CHANGED
|
@@ -2,19 +2,17 @@ import { ConsolaInstance, ConsolaOptions } from "consola";
|
|
|
2
2
|
import { UseContext } from "unctx";
|
|
3
3
|
import { GlobOptions } from "tinyglobby";
|
|
4
4
|
import { LoadConfigOptions } from "c12";
|
|
5
|
-
import { Component, ComponentsDir, ModuleDefinition, ModuleMeta, ModuleOptions, Nuxt, NuxtAppConfig, NuxtCompatibility, NuxtCompatibilityIssues, NuxtConfig, NuxtHooks, NuxtMiddleware, NuxtModule, NuxtOptions, NuxtPlugin, NuxtPluginTemplate, NuxtServerTemplate, NuxtTemplate, NuxtTypeTemplate, ResolvedNuxtTemplate, SchemaDefinition } from "@nuxt/schema";
|
|
6
|
-
import { Import,
|
|
5
|
+
import { Component, ComponentsDir, ModuleDefinition, ModuleMeta, ModuleOptions, Nuxt, NuxtAppConfig, NuxtBuildOutputs, NuxtCompatibility, NuxtCompatibilityIssues, NuxtConfig, NuxtHooks, NuxtMiddleware, NuxtModule, NuxtOptions, NuxtPlugin, NuxtPluginTemplate, NuxtServerTemplate, NuxtTemplate, NuxtTypeTemplate, ResolvedNuxtTemplate, SchemaDefinition } from "@nuxt/schema";
|
|
6
|
+
import { Import, Preset } from "unimport";
|
|
7
7
|
import { Configuration, WebpackPluginInstance } from "webpack";
|
|
8
|
-
import { RspackPluginInstance } from "@rspack/core";
|
|
9
8
|
import { Plugin, UserConfig } from "vite";
|
|
10
|
-
import
|
|
11
|
-
import * as NitroV3 from "nitro/types";
|
|
9
|
+
import { Nitro, NitroDevEventHandler, NitroEventHandler, NitroRouteConfig } from "nitropack/types";
|
|
12
10
|
|
|
13
11
|
//#region src/module/define.d.ts
|
|
14
12
|
/**
|
|
15
|
-
* Define a Nuxt module, automatically merging defaults with user provided options, installing
|
|
16
|
-
* any hooks that are provided, and calling an optional setup function for full control.
|
|
17
|
-
*/
|
|
13
|
+
* Define a Nuxt module, automatically merging defaults with user provided options, installing
|
|
14
|
+
* any hooks that are provided, and calling an optional setup function for full control.
|
|
15
|
+
*/
|
|
18
16
|
declare function defineNuxtModule<TOptions extends ModuleOptions>(definition: ModuleDefinition<TOptions, Partial<TOptions>, false> | NuxtModule<TOptions, Partial<TOptions>, false>): NuxtModule<TOptions, TOptions, false>;
|
|
19
17
|
declare function defineNuxtModule<TOptions extends ModuleOptions>(): {
|
|
20
18
|
with: <TOptionsDefaults extends Partial<TOptions>>(definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | NuxtModule<TOptions, TOptionsDefaults, true>) => NuxtModule<TOptions, TOptionsDefaults, true>;
|
|
@@ -23,15 +21,15 @@ declare function defineNuxtModule<TOptions extends ModuleOptions>(): {
|
|
|
23
21
|
//#region src/module/install.d.ts
|
|
24
22
|
type ModuleToInstall = string | NuxtModule<ModuleOptions, Partial<ModuleOptions>, false>;
|
|
25
23
|
/**
|
|
26
|
-
* Installs a set of modules on a Nuxt instance.
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
24
|
+
* Installs a set of modules on a Nuxt instance.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
29
27
|
declare function installModules(modulesToInstall: Map<ModuleToInstall, Record<string, any>>, resolvedModulePaths: Set<string>, nuxt?: Nuxt): Promise<void>;
|
|
30
28
|
/**
|
|
31
|
-
* Installs a module on a Nuxt instance.
|
|
32
|
-
* @deprecated Use module dependencies.
|
|
33
|
-
*/
|
|
34
|
-
declare function installModule<T extends string | NuxtModule, Config extends Extract<NonNullable<NuxtConfig[
|
|
29
|
+
* Installs a module on a Nuxt instance.
|
|
30
|
+
* @deprecated Use module dependencies.
|
|
31
|
+
*/
|
|
32
|
+
declare function installModule<T extends string | NuxtModule, Config extends Extract<NonNullable<NuxtConfig['modules']>[number], [T, any]>>(moduleToInstall: T, inlineOptions?: [Config] extends [never] ? any : Config[1], nuxt?: Nuxt): Promise<void>;
|
|
35
33
|
declare function resolveModuleWithOptions(definition: NuxtModule<any> | string | false | undefined | null | [(NuxtModule | string)?, Record<string, any>?], nuxt: Nuxt): {
|
|
36
34
|
resolvedPath?: string;
|
|
37
35
|
module: string | NuxtModule<any>;
|
|
@@ -47,26 +45,26 @@ declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
|
47
45
|
//#endregion
|
|
48
46
|
//#region src/module/compatibility.d.ts
|
|
49
47
|
/**
|
|
50
|
-
* Check if a Nuxt module is installed by name.
|
|
51
|
-
*
|
|
52
|
-
* This will check both the installed modules and the modules to be installed. Note
|
|
53
|
-
* that it cannot detect if a module is _going to be_ installed programmatically by another module.
|
|
54
|
-
*/
|
|
48
|
+
* Check if a Nuxt module is installed by name.
|
|
49
|
+
*
|
|
50
|
+
* This will check both the installed modules and the modules to be installed. Note
|
|
51
|
+
* that it cannot detect if a module is _going to be_ installed programmatically by another module.
|
|
52
|
+
*/
|
|
55
53
|
declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
|
|
56
54
|
/**
|
|
57
|
-
* Checks if a Nuxt module is compatible with a given semver version.
|
|
58
|
-
*/
|
|
55
|
+
* Checks if a Nuxt module is compatible with a given semver version.
|
|
56
|
+
*/
|
|
59
57
|
declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
|
|
60
58
|
/**
|
|
61
|
-
* Get the version of a Nuxt module.
|
|
62
|
-
*
|
|
63
|
-
* Scans installed modules for the version, if it's not found it will attempt to load the module instance and get the version from there.
|
|
64
|
-
*/
|
|
59
|
+
* Get the version of a Nuxt module.
|
|
60
|
+
*
|
|
61
|
+
* Scans installed modules for the version, if it's not found it will attempt to load the module instance and get the version from there.
|
|
62
|
+
*/
|
|
65
63
|
declare function getNuxtModuleVersion(module: string | NuxtModule, nuxt?: Nuxt | any): Promise<string | false>;
|
|
66
64
|
//#endregion
|
|
67
65
|
//#region src/loader/config.d.ts
|
|
68
|
-
interface LoadNuxtConfigOptions extends Omit<LoadConfigOptions<NuxtConfig>,
|
|
69
|
-
overrides?: Exclude<LoadConfigOptions<NuxtConfig>[
|
|
66
|
+
interface LoadNuxtConfigOptions extends Omit<LoadConfigOptions<NuxtConfig>, 'overrides'> {
|
|
67
|
+
overrides?: Exclude<LoadConfigOptions<NuxtConfig>['overrides'], Promise<any> | Function>;
|
|
70
68
|
}
|
|
71
69
|
declare function loadNuxtConfig(opts: LoadNuxtConfigOptions): Promise<NuxtOptions>;
|
|
72
70
|
//#endregion
|
|
@@ -107,252 +105,268 @@ interface LayerDirectories {
|
|
|
107
105
|
readonly appPlugins: string;
|
|
108
106
|
}
|
|
109
107
|
/**
|
|
110
|
-
* Get the resolved directory paths for all layers in a Nuxt application.
|
|
111
|
-
*
|
|
112
|
-
* Returns an array of LayerDirectories objects, ordered by layer priority:
|
|
113
|
-
* - The first layer is the user/project layer (highest priority)
|
|
114
|
-
* - Earlier layers override later layers in the array
|
|
115
|
-
* - Base layers appear last in the array (lowest priority)
|
|
116
|
-
*
|
|
117
|
-
* @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
|
|
118
|
-
* @returns Array of LayerDirectories objects, ordered by priority (user layer first)
|
|
119
|
-
*/
|
|
108
|
+
* Get the resolved directory paths for all layers in a Nuxt application.
|
|
109
|
+
*
|
|
110
|
+
* Returns an array of LayerDirectories objects, ordered by layer priority:
|
|
111
|
+
* - The first layer is the user/project layer (highest priority)
|
|
112
|
+
* - Earlier layers override later layers in the array
|
|
113
|
+
* - Base layers appear last in the array (lowest priority)
|
|
114
|
+
*
|
|
115
|
+
* @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
|
|
116
|
+
* @returns Array of LayerDirectories objects, ordered by priority (user layer first)
|
|
117
|
+
*/
|
|
120
118
|
declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
|
|
121
119
|
//#endregion
|
|
120
|
+
//#region src/constants.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Default extensions for files that may contain JSX.
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
declare const DEFAULT_JSX_FILE_EXTENSIONS: string[];
|
|
126
|
+
/** Default extensions for JavaScript/TypeScript files, in order of resolution priority. */
|
|
127
|
+
declare const DEFAULT_JS_FILE_EXTENSIONS: string[];
|
|
128
|
+
//#endregion
|
|
122
129
|
//#region src/head.d.ts
|
|
123
|
-
declare function setGlobalHead(head: NuxtAppConfig[
|
|
130
|
+
declare function setGlobalHead(head: NuxtAppConfig['head']): void;
|
|
124
131
|
//#endregion
|
|
125
132
|
//#region src/imports.d.ts
|
|
126
133
|
declare function addImports(imports: Import | Import[]): void;
|
|
127
134
|
declare function addImportsDir(dirs: string | string[], opts?: {
|
|
128
135
|
prepend?: boolean;
|
|
129
136
|
}): void;
|
|
130
|
-
declare function addImportsSources(presets:
|
|
137
|
+
declare function addImportsSources(presets: Preset | Preset[]): void;
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/app-config.d.ts
|
|
140
|
+
/**
|
|
141
|
+
* Update Nuxt app configuration.
|
|
142
|
+
* @since 4.5.0
|
|
143
|
+
*/
|
|
144
|
+
declare function updateAppConfig(appConfig: Record<string, unknown>): void;
|
|
131
145
|
//#endregion
|
|
132
146
|
//#region src/runtime-config.d.ts
|
|
133
147
|
/**
|
|
134
|
-
* Access 'resolved' Nuxt runtime configuration, with values updated from environment.
|
|
135
|
-
*
|
|
136
|
-
* This mirrors the runtime behavior of Nitro.
|
|
137
|
-
*/
|
|
148
|
+
* Access 'resolved' Nuxt runtime configuration, with values updated from environment.
|
|
149
|
+
*
|
|
150
|
+
* This mirrors the runtime behavior of Nitro.
|
|
151
|
+
*/
|
|
138
152
|
declare function useRuntimeConfig(): Record<string, any>;
|
|
139
153
|
/**
|
|
140
|
-
* Update Nuxt runtime configuration.
|
|
141
|
-
*/
|
|
154
|
+
* Update Nuxt runtime configuration.
|
|
155
|
+
*/
|
|
142
156
|
declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
|
|
143
157
|
//#endregion
|
|
144
158
|
//#region src/build.d.ts
|
|
145
159
|
type Arrayable<T> = T | T[];
|
|
146
160
|
type Thenable<T> = T | Promise<T>;
|
|
161
|
+
type RspackCompatiblePluginInstance = {
|
|
162
|
+
apply: (...args: any[]) => void;
|
|
163
|
+
[k: string]: any;
|
|
164
|
+
};
|
|
147
165
|
interface ExtendConfigOptions {
|
|
148
166
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
167
|
+
* Install plugin on dev
|
|
168
|
+
* @default true
|
|
169
|
+
*/
|
|
152
170
|
dev?: boolean;
|
|
153
171
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
172
|
+
* Install plugin on build
|
|
173
|
+
* @default true
|
|
174
|
+
*/
|
|
157
175
|
build?: boolean;
|
|
158
176
|
/**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
177
|
+
* Install plugin on server side
|
|
178
|
+
* @default true
|
|
179
|
+
*/
|
|
162
180
|
server?: boolean;
|
|
163
181
|
/**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
182
|
+
* Install plugin on client side
|
|
183
|
+
* @default true
|
|
184
|
+
*/
|
|
167
185
|
client?: boolean;
|
|
168
186
|
/**
|
|
169
|
-
|
|
170
|
-
|
|
187
|
+
* Prepends the plugin to the array with `unshift()` instead of `push()`.
|
|
188
|
+
*/
|
|
171
189
|
prepend?: boolean;
|
|
172
190
|
}
|
|
173
191
|
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {}
|
|
174
|
-
interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions,
|
|
192
|
+
interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, 'server' | 'client'> {
|
|
175
193
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
194
|
+
* Extend server Vite configuration
|
|
195
|
+
* @default true
|
|
196
|
+
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
|
|
197
|
+
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
|
|
198
|
+
* You can likely use a Vite plugin to achieve the same result.
|
|
199
|
+
*/
|
|
182
200
|
server?: boolean;
|
|
183
201
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
202
|
+
* Extend client Vite configuration
|
|
203
|
+
* @default true
|
|
204
|
+
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
|
|
205
|
+
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
|
|
206
|
+
* You can likely use a Vite plugin to achieve the same result.
|
|
207
|
+
*/
|
|
190
208
|
client?: boolean;
|
|
191
209
|
}
|
|
192
210
|
type ExtendWebpacklikeConfig = (fn: (config: Configuration) => void, options?: ExtendWebpackConfigOptions) => void;
|
|
193
211
|
/**
|
|
194
|
-
* Extend webpack config
|
|
195
|
-
*
|
|
196
|
-
* The fallback function might be called multiple times
|
|
197
|
-
* when applying to both client and server builds.
|
|
198
|
-
*/
|
|
212
|
+
* Extend webpack config
|
|
213
|
+
*
|
|
214
|
+
* The fallback function might be called multiple times
|
|
215
|
+
* when applying to both client and server builds.
|
|
216
|
+
*/
|
|
199
217
|
declare const extendWebpackConfig: ExtendWebpacklikeConfig;
|
|
200
218
|
/**
|
|
201
|
-
* Extend rspack config
|
|
202
|
-
*
|
|
203
|
-
* The fallback function might be called multiple times
|
|
204
|
-
* when applying to both client and server builds.
|
|
205
|
-
*/
|
|
219
|
+
* Extend rspack config
|
|
220
|
+
*
|
|
221
|
+
* The fallback function might be called multiple times
|
|
222
|
+
* when applying to both client and server builds.
|
|
223
|
+
*/
|
|
206
224
|
declare const extendRspackConfig: ExtendWebpacklikeConfig;
|
|
207
225
|
/**
|
|
208
|
-
* Extend Vite config
|
|
209
|
-
*/
|
|
226
|
+
* Extend Vite config
|
|
227
|
+
*/
|
|
210
228
|
declare function extendViteConfig(fn: ((config: UserConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
|
|
211
229
|
/**
|
|
212
|
-
* Append webpack plugin to the config.
|
|
213
|
-
*/
|
|
230
|
+
* Append webpack plugin to the config.
|
|
231
|
+
*/
|
|
214
232
|
declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
215
233
|
/**
|
|
216
|
-
* Append rspack plugin to the config.
|
|
217
|
-
*/
|
|
218
|
-
declare function addRspackPlugin(pluginOrGetter: Arrayable<
|
|
234
|
+
* Append rspack plugin to the config.
|
|
235
|
+
*/
|
|
236
|
+
declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackCompatiblePluginInstance> | (() => Thenable<Arrayable<RspackCompatiblePluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
219
237
|
/**
|
|
220
|
-
* Append Vite plugin to the config.
|
|
221
|
-
*/
|
|
238
|
+
* Append Vite plugin to the config.
|
|
239
|
+
*/
|
|
222
240
|
declare function addVitePlugin(pluginOrGetter: Arrayable<Plugin> | (() => Thenable<Arrayable<Plugin>>), options?: ExtendConfigOptions): void;
|
|
223
241
|
interface AddBuildPluginFactory {
|
|
224
242
|
vite?: () => Thenable<Arrayable<Plugin>>;
|
|
225
243
|
webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
|
|
226
|
-
rspack?: () => Thenable<Arrayable<
|
|
244
|
+
rspack?: () => Thenable<Arrayable<RspackCompatiblePluginInstance>>;
|
|
227
245
|
}
|
|
228
246
|
declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
|
|
247
|
+
/**
|
|
248
|
+
* Set the build output for the given key. See {@link NuxtBuildOutputs}.
|
|
249
|
+
*/
|
|
250
|
+
declare function setBuildOutput<K extends keyof NuxtBuildOutputs>(key: K, provider: NuxtBuildOutputs[K], nuxt?: Nuxt): void;
|
|
229
251
|
//#endregion
|
|
230
252
|
//#region src/compatibility.d.ts
|
|
231
253
|
declare function normalizeSemanticVersion(version: string): string;
|
|
232
254
|
/**
|
|
233
|
-
* Check version constraints and return incompatibility issues as an array
|
|
234
|
-
*/
|
|
255
|
+
* Check version constraints and return incompatibility issues as an array
|
|
256
|
+
*/
|
|
235
257
|
declare function checkNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<NuxtCompatibilityIssues>;
|
|
236
258
|
/**
|
|
237
|
-
* Check version constraints and throw a detailed error if has any, otherwise returns true
|
|
238
|
-
*/
|
|
259
|
+
* Check version constraints and throw a detailed error if has any, otherwise returns true
|
|
260
|
+
*/
|
|
239
261
|
declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<true>;
|
|
240
262
|
/**
|
|
241
|
-
* Check version constraints and return true if passed, otherwise returns false
|
|
242
|
-
*/
|
|
263
|
+
* Check version constraints and return true if passed, otherwise returns false
|
|
264
|
+
*/
|
|
243
265
|
declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
|
|
244
266
|
type NuxtMajorVersion = 2 | 3 | 4;
|
|
245
267
|
/**
|
|
246
|
-
* Check if current Nuxt instance is of specified major version
|
|
247
|
-
*/
|
|
268
|
+
* Check if current Nuxt instance is of specified major version
|
|
269
|
+
*/
|
|
248
270
|
declare function isNuxtMajorVersion(majorVersion: NuxtMajorVersion, nuxt?: Nuxt): boolean;
|
|
249
271
|
/**
|
|
250
|
-
* @deprecated Use `isNuxtMajorVersion(2, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
251
|
-
*/
|
|
272
|
+
* @deprecated Use `isNuxtMajorVersion(2, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
273
|
+
*/
|
|
252
274
|
declare function isNuxt2(nuxt?: Nuxt): boolean;
|
|
253
275
|
/**
|
|
254
|
-
* @deprecated Use `isNuxtMajorVersion(3, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
255
|
-
*/
|
|
276
|
+
* @deprecated Use `isNuxtMajorVersion(3, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
277
|
+
*/
|
|
256
278
|
declare function isNuxt3(nuxt?: Nuxt): boolean;
|
|
257
279
|
/**
|
|
258
|
-
* Get nuxt version
|
|
259
|
-
*/
|
|
280
|
+
* Get nuxt version
|
|
281
|
+
*/
|
|
260
282
|
declare function getNuxtVersion(nuxt?: Nuxt | any): string;
|
|
261
283
|
//#endregion
|
|
262
284
|
//#region src/components.d.ts
|
|
263
285
|
/**
|
|
264
|
-
* Register a directory to be scanned for components and imported only when used.
|
|
265
|
-
*/
|
|
286
|
+
* Register a directory to be scanned for components and imported only when used.
|
|
287
|
+
*/
|
|
266
288
|
declare function addComponentsDir(dir: ComponentsDir, opts?: {
|
|
267
289
|
prepend?: boolean;
|
|
268
290
|
}): void;
|
|
269
291
|
type AddComponentOptions = {
|
|
270
292
|
name: string;
|
|
271
293
|
filePath: string;
|
|
272
|
-
} & Partial<Exclude<Component,
|
|
294
|
+
} & Partial<Exclude<Component, 'shortPath' | 'async' | 'level' | 'import' | 'asyncImport'>>;
|
|
273
295
|
/**
|
|
274
|
-
* This utility takes a file path or npm package that is scanned for named exports, which are get added automatically
|
|
275
|
-
*/
|
|
276
|
-
declare function addComponentExports(opts: Omit<AddComponentOptions,
|
|
296
|
+
* This utility takes a file path or npm package that is scanned for named exports, which are get added automatically
|
|
297
|
+
*/
|
|
298
|
+
declare function addComponentExports(opts: Omit<AddComponentOptions, 'name'> & {
|
|
277
299
|
prefix?: string;
|
|
278
300
|
}): void;
|
|
279
301
|
/**
|
|
280
|
-
* Register a component by its name and filePath.
|
|
281
|
-
*/
|
|
302
|
+
* Register a component by its name and filePath.
|
|
303
|
+
*/
|
|
282
304
|
declare function addComponent(opts: AddComponentOptions): void;
|
|
283
305
|
//#endregion
|
|
284
306
|
//#region src/context.d.ts
|
|
285
307
|
/**
|
|
286
|
-
* Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
|
|
287
|
-
* @deprecated Use `getNuxtCtx` instead
|
|
288
|
-
*/
|
|
308
|
+
* Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
|
|
309
|
+
* @deprecated Use `getNuxtCtx` instead
|
|
310
|
+
*/
|
|
289
311
|
declare const nuxtCtx: UseContext<Nuxt>;
|
|
290
312
|
/** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
|
|
291
313
|
declare const getNuxtCtx: () => Nuxt | null;
|
|
292
314
|
/**
|
|
293
|
-
* Get access to Nuxt instance.
|
|
294
|
-
*
|
|
295
|
-
* Throws an error if Nuxt instance is unavailable.
|
|
296
|
-
* @example
|
|
297
|
-
* ```js
|
|
298
|
-
* const nuxt = useNuxt()
|
|
299
|
-
* ```
|
|
300
|
-
*/
|
|
315
|
+
* Get access to Nuxt instance.
|
|
316
|
+
*
|
|
317
|
+
* Throws an error if Nuxt instance is unavailable.
|
|
318
|
+
* @example
|
|
319
|
+
* ```js
|
|
320
|
+
* const nuxt = useNuxt()
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
301
323
|
declare function useNuxt(): Nuxt;
|
|
302
324
|
/**
|
|
303
|
-
* Get access to Nuxt instance.
|
|
304
|
-
*
|
|
305
|
-
* Returns null if Nuxt instance is unavailable.
|
|
306
|
-
* @example
|
|
307
|
-
* ```js
|
|
308
|
-
* const nuxt = tryUseNuxt()
|
|
309
|
-
* if (nuxt) {
|
|
310
|
-
* // Do something
|
|
311
|
-
* }
|
|
312
|
-
* ```
|
|
313
|
-
*/
|
|
325
|
+
* Get access to Nuxt instance.
|
|
326
|
+
*
|
|
327
|
+
* Returns null if Nuxt instance is unavailable.
|
|
328
|
+
* @example
|
|
329
|
+
* ```js
|
|
330
|
+
* const nuxt = tryUseNuxt()
|
|
331
|
+
* if (nuxt) {
|
|
332
|
+
* // Do something
|
|
333
|
+
* }
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
314
336
|
declare function tryUseNuxt(): Nuxt | null;
|
|
315
337
|
declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
|
|
316
338
|
//#endregion
|
|
317
339
|
//#region src/ignore.d.ts
|
|
318
340
|
declare function createIsIgnored(nuxt?: Nuxt | null | undefined): (pathname: string, stats?: unknown) => boolean;
|
|
319
341
|
/**
|
|
320
|
-
* Return a filter function to filter an array of paths
|
|
321
|
-
*/
|
|
342
|
+
* Return a filter function to filter an array of paths
|
|
343
|
+
*/
|
|
322
344
|
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: Nuxt | null | undefined): boolean;
|
|
323
345
|
declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
324
346
|
//#endregion
|
|
325
347
|
//#region src/layout.d.ts
|
|
326
348
|
declare function addLayout(template: NuxtTemplate | string, name?: string): void;
|
|
327
349
|
//#endregion
|
|
328
|
-
//#region src/nitro-types.d.ts
|
|
329
|
-
type isNitroV2 = "options" extends keyof NitroV2.Nitro ? "___INVALID" extends keyof NitroV2.Nitro ? false : true : false;
|
|
330
|
-
type isNitroV3 = "options" extends keyof NitroV3.Nitro ? "___INVALID" extends keyof NitroV3.Nitro ? false : true : false;
|
|
331
|
-
type Nitro = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.Nitro | NitroV3.Nitro : NitroV2.Nitro : NitroV3.Nitro;
|
|
332
|
-
type NitroDevEventHandler = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroDevEventHandler | NitroV3.NitroDevEventHandler : NitroV2.NitroDevEventHandler : NitroV3.NitroDevEventHandler;
|
|
333
|
-
type NitroEventHandler = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroEventHandler | NitroV3.NitroEventHandler : NitroV2.NitroEventHandler : NitroV3.NitroEventHandler;
|
|
334
|
-
type NitroRouteConfig = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroRouteConfig | NitroV3.NitroRouteConfig : NitroV2.NitroRouteConfig : NitroV3.NitroRouteConfig;
|
|
335
|
-
//#endregion
|
|
336
350
|
//#region src/pages.d.ts
|
|
337
|
-
declare function extendPages(cb: NuxtHooks[
|
|
351
|
+
declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
338
352
|
interface ExtendRouteRulesOptions {
|
|
339
353
|
/**
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
354
|
+
* Override route rule config
|
|
355
|
+
* @default false
|
|
356
|
+
*/
|
|
343
357
|
override?: boolean;
|
|
344
358
|
}
|
|
345
359
|
declare function extendRouteRules(route: string, rule: NitroRouteConfig, options?: ExtendRouteRulesOptions): void;
|
|
346
360
|
interface AddRouteMiddlewareOptions {
|
|
347
361
|
/**
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
362
|
+
* Override existing middleware with the same name, if it exists
|
|
363
|
+
* @default false
|
|
364
|
+
*/
|
|
351
365
|
override?: boolean;
|
|
352
366
|
/**
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
367
|
+
* Prepend middleware to the list
|
|
368
|
+
* @default false
|
|
369
|
+
*/
|
|
356
370
|
prepend?: boolean;
|
|
357
371
|
}
|
|
358
372
|
declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], options?: AddRouteMiddlewareOptions): void;
|
|
@@ -360,30 +374,30 @@ declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], op
|
|
|
360
374
|
//#region src/plugin.d.ts
|
|
361
375
|
declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
362
376
|
/**
|
|
363
|
-
* Registers a nuxt plugin and to the plugins array.
|
|
364
|
-
*
|
|
365
|
-
* Note: You can use mode or .client and .server modifiers with fileName option
|
|
366
|
-
* to use plugin only in client or server side.
|
|
367
|
-
*
|
|
368
|
-
* Note: By default plugin is prepended to the plugins array. You can use second argument to append (push) instead.
|
|
369
|
-
* @example
|
|
370
|
-
* ```js
|
|
371
|
-
* import { createResolver } from '@nuxt/kit'
|
|
372
|
-
* const resolver = createResolver(import.meta.url)
|
|
373
|
-
*
|
|
374
|
-
* addPlugin({
|
|
375
|
-
* src: resolver.resolve('templates/foo.js'),
|
|
376
|
-
* filename: 'foo.server.js' // [optional] only include in server bundle
|
|
377
|
-
* })
|
|
378
|
-
* ```
|
|
379
|
-
*/
|
|
377
|
+
* Registers a nuxt plugin and to the plugins array.
|
|
378
|
+
*
|
|
379
|
+
* Note: You can use mode or .client and .server modifiers with fileName option
|
|
380
|
+
* to use plugin only in client or server side.
|
|
381
|
+
*
|
|
382
|
+
* Note: By default plugin is prepended to the plugins array. You can use second argument to append (push) instead.
|
|
383
|
+
* @example
|
|
384
|
+
* ```js
|
|
385
|
+
* import { createResolver } from '@nuxt/kit'
|
|
386
|
+
* const resolver = createResolver(import.meta.url)
|
|
387
|
+
*
|
|
388
|
+
* addPlugin({
|
|
389
|
+
* src: resolver.resolve('templates/foo.js'),
|
|
390
|
+
* filename: 'foo.server.js' // [optional] only include in server bundle
|
|
391
|
+
* })
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
380
394
|
interface AddPluginOptions {
|
|
381
395
|
append?: boolean;
|
|
382
396
|
}
|
|
383
397
|
declare function addPlugin(_plugin: NuxtPlugin | string, opts?: AddPluginOptions): NuxtPlugin;
|
|
384
398
|
/**
|
|
385
|
-
* Adds a template and registers as a nuxt plugin.
|
|
386
|
-
*/
|
|
399
|
+
* Adds a template and registers as a nuxt plugin.
|
|
400
|
+
*/
|
|
387
401
|
declare function addPluginTemplate(plugin: NuxtPluginTemplate | string, opts?: AddPluginOptions): NuxtPlugin;
|
|
388
402
|
//#endregion
|
|
389
403
|
//#region src/resolve.d.ts
|
|
@@ -393,136 +407,136 @@ interface ResolvePathOptions {
|
|
|
393
407
|
/** An object of aliases. Default is Nuxt configured aliases. */
|
|
394
408
|
alias?: Record<string, string>;
|
|
395
409
|
/**
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
410
|
+
* The file extensions to try.
|
|
411
|
+
* Default is Nuxt configured extensions.
|
|
412
|
+
*
|
|
413
|
+
* Isn't considered when `type` is set to `'dir'`.
|
|
414
|
+
*/
|
|
401
415
|
extensions?: string[];
|
|
402
416
|
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
417
|
+
* Whether to resolve files that exist in the Nuxt VFS (for example, as a Nuxt template).
|
|
418
|
+
* @default false
|
|
419
|
+
*/
|
|
406
420
|
virtual?: boolean;
|
|
407
421
|
/**
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
422
|
+
* Whether to fallback to the original path if the resolved path does not exist instead of returning the normalized input path.
|
|
423
|
+
* @default false
|
|
424
|
+
*/
|
|
411
425
|
fallbackToOriginal?: boolean;
|
|
412
426
|
/**
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
427
|
+
* The type of the path to be resolved.
|
|
428
|
+
* @default 'file'
|
|
429
|
+
*/
|
|
416
430
|
type?: PathType;
|
|
417
431
|
}
|
|
418
432
|
/**
|
|
419
|
-
* Resolve the full path to a file or a directory (based on the provided type), respecting Nuxt alias and extensions options.
|
|
420
|
-
*
|
|
421
|
-
* If a path cannot be resolved, normalized input will be returned unless the `fallbackToOriginal` option is set to `true`,
|
|
422
|
-
* in which case the original input path will be returned.
|
|
423
|
-
*/
|
|
433
|
+
* Resolve the full path to a file or a directory (based on the provided type), respecting Nuxt alias and extensions options.
|
|
434
|
+
*
|
|
435
|
+
* If a path cannot be resolved, normalized input will be returned unless the `fallbackToOriginal` option is set to `true`,
|
|
436
|
+
* in which case the original input path will be returned.
|
|
437
|
+
*/
|
|
424
438
|
declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
|
|
425
439
|
/**
|
|
426
|
-
* Try to resolve first existing file in paths
|
|
427
|
-
*/
|
|
440
|
+
* Try to resolve first existing file in paths
|
|
441
|
+
*/
|
|
428
442
|
declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: PathType): Promise<string | null>;
|
|
429
443
|
/**
|
|
430
|
-
* Resolve path aliases respecting Nuxt alias options
|
|
431
|
-
*/
|
|
444
|
+
* Resolve path aliases respecting Nuxt alias options
|
|
445
|
+
*/
|
|
432
446
|
declare function resolveAlias(path: string, alias?: Record<string, string>): string;
|
|
433
447
|
interface Resolver {
|
|
434
448
|
resolve(...path: string[]): string;
|
|
435
449
|
resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
|
|
436
450
|
}
|
|
437
451
|
/**
|
|
438
|
-
* Create a relative resolver
|
|
439
|
-
*/
|
|
452
|
+
* Create a relative resolver
|
|
453
|
+
*/
|
|
440
454
|
declare function createResolver(base: string | URL): Resolver;
|
|
441
455
|
declare function resolveNuxtModule(base: string, paths: string[]): Promise<string[]>;
|
|
442
|
-
type PathType =
|
|
443
|
-
/**
|
|
444
|
-
* Resolve absolute file paths in the provided directory with respect to `.nuxtignore` and return them sorted.
|
|
445
|
-
* @param path path to the directory to resolve files in
|
|
446
|
-
* @param pattern glob pattern or an array of glob patterns to match files
|
|
447
|
-
* @param opts options for globbing
|
|
448
|
-
* @param opts.followSymbolicLinks whether to follow symbolic links, default is `true`
|
|
449
|
-
* @param opts.ignore additional glob patterns to ignore
|
|
450
|
-
* @returns sorted array of absolute file paths
|
|
451
|
-
*/
|
|
456
|
+
type PathType = 'file' | 'dir';
|
|
457
|
+
/**
|
|
458
|
+
* Resolve absolute file paths in the provided directory with respect to `.nuxtignore` and return them sorted.
|
|
459
|
+
* @param path path to the directory to resolve files in
|
|
460
|
+
* @param pattern glob pattern or an array of glob patterns to match files
|
|
461
|
+
* @param opts options for globbing
|
|
462
|
+
* @param opts.followSymbolicLinks whether to follow symbolic links, default is `true`
|
|
463
|
+
* @param opts.ignore additional glob patterns to ignore
|
|
464
|
+
* @returns sorted array of absolute file paths
|
|
465
|
+
*/
|
|
452
466
|
declare function resolveFiles(path: string, pattern: string | string[], opts?: {
|
|
453
467
|
followSymbolicLinks?: boolean;
|
|
454
|
-
ignore?: GlobOptions[
|
|
468
|
+
ignore?: GlobOptions['ignore'];
|
|
455
469
|
}): Promise<string[]>;
|
|
456
470
|
//#endregion
|
|
457
471
|
//#region src/nitro.d.ts
|
|
458
472
|
/**
|
|
459
|
-
* Adds a nitro server handler
|
|
460
|
-
*
|
|
461
|
-
*/
|
|
473
|
+
* Adds a nitro server handler
|
|
474
|
+
*
|
|
475
|
+
*/
|
|
462
476
|
declare function addServerHandler(handler: NitroEventHandler): void;
|
|
463
477
|
/**
|
|
464
|
-
* Adds a nitro server handler for development-only
|
|
465
|
-
*
|
|
466
|
-
*/
|
|
478
|
+
* Adds a nitro server handler for development-only
|
|
479
|
+
*
|
|
480
|
+
*/
|
|
467
481
|
declare function addDevServerHandler(handler: NitroDevEventHandler): void;
|
|
468
482
|
/**
|
|
469
|
-
* Adds a Nitro plugin
|
|
470
|
-
*/
|
|
483
|
+
* Adds a Nitro plugin
|
|
484
|
+
*/
|
|
471
485
|
declare function addServerPlugin(plugin: string): void;
|
|
472
486
|
/**
|
|
473
|
-
* Adds routes to be prerendered
|
|
474
|
-
*/
|
|
487
|
+
* Adds routes to be prerendered
|
|
488
|
+
*/
|
|
475
489
|
declare function addPrerenderRoutes(routes: string | string[]): void;
|
|
476
490
|
/**
|
|
477
|
-
* Access to the Nitro instance
|
|
478
|
-
*
|
|
479
|
-
* **Note:** You can call `useNitro()` only after `ready` hook.
|
|
480
|
-
*
|
|
481
|
-
* **Note:** Changes to the Nitro instance configuration are not applied.
|
|
482
|
-
* @example
|
|
483
|
-
*
|
|
484
|
-
* ```ts
|
|
485
|
-
* nuxt.hook('ready', () => {
|
|
486
|
-
* console.log(useNitro())
|
|
487
|
-
* })
|
|
488
|
-
* ```
|
|
489
|
-
*/
|
|
491
|
+
* Access to the Nitro instance
|
|
492
|
+
*
|
|
493
|
+
* **Note:** You can call `useNitro()` only after `ready` hook.
|
|
494
|
+
*
|
|
495
|
+
* **Note:** Changes to the Nitro instance configuration are not applied.
|
|
496
|
+
* @example
|
|
497
|
+
*
|
|
498
|
+
* ```ts
|
|
499
|
+
* nuxt.hook('ready', () => {
|
|
500
|
+
* console.log(useNitro())
|
|
501
|
+
* })
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
490
504
|
declare function useNitro(): Nitro;
|
|
491
505
|
/**
|
|
492
|
-
* Add server imports to be auto-imported by Nitro
|
|
493
|
-
*/
|
|
506
|
+
* Add server imports to be auto-imported by Nitro
|
|
507
|
+
*/
|
|
494
508
|
declare function addServerImports(imports: Import | Import[]): void;
|
|
495
509
|
/**
|
|
496
|
-
* Add directories to be scanned for auto-imports by Nitro
|
|
497
|
-
*/
|
|
510
|
+
* Add directories to be scanned for auto-imports by Nitro
|
|
511
|
+
*/
|
|
498
512
|
declare function addServerImportsDir(dirs: string | string[], opts?: {
|
|
499
513
|
prepend?: boolean;
|
|
500
514
|
}): void;
|
|
501
515
|
/**
|
|
502
|
-
* Add directories to be scanned by Nitro. It will check for subdirectories,
|
|
503
|
-
* which will be registered just like the `~~/server` folder is.
|
|
504
|
-
*/
|
|
516
|
+
* Add directories to be scanned by Nitro. It will check for subdirectories,
|
|
517
|
+
* which will be registered just like the `~~/server` folder is.
|
|
518
|
+
*/
|
|
505
519
|
declare function addServerScanDir(dirs: string | string[], opts?: {
|
|
506
520
|
prepend?: boolean;
|
|
507
521
|
}): void;
|
|
508
522
|
//#endregion
|
|
509
523
|
//#region src/template.d.ts
|
|
510
524
|
/**
|
|
511
|
-
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
|
|
512
|
-
*/
|
|
525
|
+
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
|
|
526
|
+
*/
|
|
513
527
|
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
514
528
|
/**
|
|
515
|
-
* Adds a virtual file that can be used within the Nuxt Nitro server build.
|
|
516
|
-
*/
|
|
529
|
+
* Adds a virtual file that can be used within the Nuxt Nitro server build.
|
|
530
|
+
*/
|
|
517
531
|
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
|
|
518
532
|
/**
|
|
519
|
-
* Renders given types during build to disk in the project `buildDir`
|
|
520
|
-
* and register them as types.
|
|
521
|
-
*
|
|
522
|
-
* You can pass a second context object to specify in which context the type should be added.
|
|
523
|
-
*
|
|
524
|
-
* If no context object is passed, then it will only be added to the nuxt context.
|
|
525
|
-
*/
|
|
533
|
+
* Renders given types during build to disk in the project `buildDir`
|
|
534
|
+
* and register them as types.
|
|
535
|
+
*
|
|
536
|
+
* You can pass a second context object to specify in which context the type should be added.
|
|
537
|
+
*
|
|
538
|
+
* If no context object is passed, then it will only be added to the nuxt context.
|
|
539
|
+
*/
|
|
526
540
|
declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>, context?: {
|
|
527
541
|
nitro?: boolean;
|
|
528
542
|
nuxt?: boolean;
|
|
@@ -530,38 +544,816 @@ declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>, context?: {
|
|
|
530
544
|
shared?: boolean;
|
|
531
545
|
}): ResolvedNuxtTemplate<T>;
|
|
532
546
|
/**
|
|
533
|
-
* Normalize a nuxt template object
|
|
534
|
-
*/
|
|
547
|
+
* Normalize a nuxt template object
|
|
548
|
+
*/
|
|
535
549
|
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildDir?: string): ResolvedNuxtTemplate<T>;
|
|
536
550
|
/**
|
|
537
|
-
* Trigger rebuilding Nuxt templates
|
|
538
|
-
*
|
|
539
|
-
* You can pass a filter within the options to selectively regenerate a subset of templates.
|
|
540
|
-
*/
|
|
551
|
+
* Trigger rebuilding Nuxt templates
|
|
552
|
+
*
|
|
553
|
+
* You can pass a filter within the options to selectively regenerate a subset of templates.
|
|
554
|
+
*/
|
|
541
555
|
declare function updateTemplates(options?: {
|
|
542
556
|
filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
|
|
543
557
|
}): Promise<void>;
|
|
544
558
|
declare function writeTypes(nuxt: Nuxt): Promise<void>;
|
|
545
559
|
//#endregion
|
|
560
|
+
//#region src/types.d.ts
|
|
561
|
+
/**
|
|
562
|
+
* Rewrite a resolved module path to the declaration file TypeScript will load for it.
|
|
563
|
+
*
|
|
564
|
+
* A `.d.ts` / `.d.mts` / `.d.cts` or `.ts` / `.tsx` path is returned unchanged (or with
|
|
565
|
+
* the extension stripped, where TypeScript's extensionless `paths` retry will find it).
|
|
566
|
+
* A `.mjs` / `.cjs` / `.mts` / `.cts` runtime path is rewritten to an adjacent declaration
|
|
567
|
+
* sibling when one exists; otherwise it is returned as-is for the caller to handle.
|
|
568
|
+
*/
|
|
569
|
+
declare function resolveDeclarationPath(absolutePath: string): Promise<string>;
|
|
570
|
+
/** Extract the package name (including scope) from a (possibly subpath) module specifier. */
|
|
571
|
+
declare function packageName(specifier: string): string;
|
|
572
|
+
/**
|
|
573
|
+
* Resolve auto-import / `tsConfig.paths` entries to the path TypeScript should load types from.
|
|
574
|
+
*
|
|
575
|
+
* A bare package resolves to its package root, so TypeScript follows the package's own
|
|
576
|
+
* `exports` / `types` (which may differ from the file its `.` export condition points at).
|
|
577
|
+
* A subpath export resolves to its entry's declaration sibling when one exists, otherwise to
|
|
578
|
+
* the resolved file itself.
|
|
579
|
+
*
|
|
580
|
+
* Returns `[specifier, absolutePath]` pairs, omitting any specifier that cannot be resolved.
|
|
581
|
+
*/
|
|
582
|
+
declare function resolveTypePaths(packages: string[], searchPaths: string[]): Promise<Array<[string, string]>>;
|
|
583
|
+
//#endregion
|
|
546
584
|
//#region src/logger.d.ts
|
|
547
585
|
declare const logger: ConsolaInstance;
|
|
548
586
|
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
|
|
549
587
|
//#endregion
|
|
588
|
+
//#region src/diagnostics/build.d.ts
|
|
589
|
+
/**
|
|
590
|
+
* B1xxx
|
|
591
|
+
* Build / compilation diagnostics.
|
|
592
|
+
*
|
|
593
|
+
* @internal
|
|
594
|
+
*/
|
|
595
|
+
declare const buildDiagnostics: import("nostics").Diagnostics<{
|
|
596
|
+
readonly NUXT_B1001: {
|
|
597
|
+
readonly why: (p: {
|
|
598
|
+
filename: string;
|
|
599
|
+
}) => string;
|
|
600
|
+
readonly fix: (p: {
|
|
601
|
+
src?: string;
|
|
602
|
+
}) => string;
|
|
603
|
+
readonly docs: false;
|
|
604
|
+
};
|
|
605
|
+
readonly NUXT_B1002: {
|
|
606
|
+
readonly why: (p: {
|
|
607
|
+
src: string;
|
|
608
|
+
}) => string;
|
|
609
|
+
readonly fix: "Check that the template `src` path exists and is readable.";
|
|
610
|
+
readonly docs: false;
|
|
611
|
+
};
|
|
612
|
+
readonly NUXT_B1003: {
|
|
613
|
+
readonly why: "Invalid template. Templates must have either `src` or `getContents`.";
|
|
614
|
+
readonly fix: "Add a `getContents` function or a `src` path to the `addTemplate()` call.";
|
|
615
|
+
readonly docs: false;
|
|
616
|
+
};
|
|
617
|
+
readonly NUXT_B1004: {
|
|
618
|
+
readonly why: "Failed to install dependencies.";
|
|
619
|
+
readonly fix: (p: {
|
|
620
|
+
packages: string;
|
|
621
|
+
}) => string;
|
|
622
|
+
readonly docs: false;
|
|
623
|
+
};
|
|
624
|
+
readonly NUXT_B1005: {
|
|
625
|
+
readonly why: (p: {
|
|
626
|
+
plugin: string;
|
|
627
|
+
file: string;
|
|
628
|
+
}) => string;
|
|
629
|
+
readonly fix: "Check the file for syntax errors, or report this issue to the plugin author.";
|
|
630
|
+
readonly docs: false;
|
|
631
|
+
};
|
|
632
|
+
readonly NUXT_B1006: {
|
|
633
|
+
readonly why: (p: {
|
|
634
|
+
file: string;
|
|
635
|
+
}) => string;
|
|
636
|
+
readonly fix: "Check that the file exists and has correct permissions.";
|
|
637
|
+
readonly docs: false;
|
|
638
|
+
};
|
|
639
|
+
readonly NUXT_B1007: {
|
|
640
|
+
readonly why: (p: {
|
|
641
|
+
plugin: string;
|
|
642
|
+
}) => string;
|
|
643
|
+
readonly fix: "Check the plugin implementation or report this issue to the plugin author.";
|
|
644
|
+
readonly docs: false;
|
|
645
|
+
};
|
|
646
|
+
readonly NUXT_B1008: {
|
|
647
|
+
readonly why: (p: {
|
|
648
|
+
function: string;
|
|
649
|
+
file: string;
|
|
650
|
+
}) => string;
|
|
651
|
+
readonly fix: "Please report this issue at https://github.com/nuxt/nuxt/issues with the file contents.";
|
|
652
|
+
readonly docs: false;
|
|
653
|
+
};
|
|
654
|
+
readonly NUXT_B1009: {
|
|
655
|
+
readonly why: (p: {
|
|
656
|
+
functionName: string;
|
|
657
|
+
name?: string;
|
|
658
|
+
source?: string;
|
|
659
|
+
}) => string;
|
|
660
|
+
readonly fix: "Ensure each keyed function has a unique name, or use a different source to distinguish them.";
|
|
661
|
+
readonly docs: false;
|
|
662
|
+
};
|
|
663
|
+
readonly NUXT_B1010: {
|
|
664
|
+
readonly why: (p: {
|
|
665
|
+
file: string;
|
|
666
|
+
}) => string;
|
|
667
|
+
readonly fix: "The file was modified while being read, usually by a concurrent process writing to it. Try restarting the build.";
|
|
668
|
+
readonly docs: false;
|
|
669
|
+
};
|
|
670
|
+
readonly NUXT_B1011: {
|
|
671
|
+
readonly why: (p: {
|
|
672
|
+
file: string;
|
|
673
|
+
}) => string;
|
|
674
|
+
readonly fix: "Check that the file exists and is readable, or try clearing the build cache with `nuxt clean`.";
|
|
675
|
+
readonly docs: false;
|
|
676
|
+
};
|
|
677
|
+
readonly NUXT_B1012: {
|
|
678
|
+
readonly why: (p: {
|
|
679
|
+
path: string;
|
|
680
|
+
}) => string;
|
|
681
|
+
readonly fix: "Delete the cache with `nuxt clean` and rebuild.";
|
|
682
|
+
readonly docs: false;
|
|
683
|
+
};
|
|
684
|
+
readonly NUXT_B1013: {
|
|
685
|
+
readonly why: (p: {
|
|
686
|
+
file: string;
|
|
687
|
+
}) => string;
|
|
688
|
+
readonly fix: "Try clearing the build cache with `nuxt clean` and rebuilding from scratch.";
|
|
689
|
+
readonly docs: false;
|
|
690
|
+
};
|
|
691
|
+
readonly NUXT_B1014: {
|
|
692
|
+
readonly why: "Problem checking for external configuration files.";
|
|
693
|
+
readonly fix: "This is likely a transient file system error. If it persists, check file permissions in your project root.";
|
|
694
|
+
readonly docs: false;
|
|
695
|
+
};
|
|
696
|
+
readonly NUXT_B1015: {
|
|
697
|
+
readonly why: "Falling back to `chokidar-granular` as `@parcel/watcher` cannot be resolved in your project.";
|
|
698
|
+
readonly fix: "Install `@parcel/watcher` for better performance: `npm install -D @parcel/watcher`.";
|
|
699
|
+
readonly docs: false;
|
|
700
|
+
};
|
|
701
|
+
readonly NUXT_B1016: {
|
|
702
|
+
readonly why: "Failed to set up the `@parcel/watcher` file watcher.";
|
|
703
|
+
readonly fix: "This is likely an environment or file system issue. Watching for file changes may not work; restart the dev server and, if the problem persists, report it.";
|
|
704
|
+
readonly docs: false;
|
|
705
|
+
};
|
|
706
|
+
readonly NUXT_B1017: {
|
|
707
|
+
readonly why: (p: {
|
|
708
|
+
builder: string;
|
|
709
|
+
}) => string;
|
|
710
|
+
readonly fix: (p: {
|
|
711
|
+
builder: string;
|
|
712
|
+
}) => string;
|
|
713
|
+
readonly docs: false;
|
|
714
|
+
};
|
|
715
|
+
readonly NUXT_B1018: {
|
|
716
|
+
readonly why: (p: {
|
|
717
|
+
builder: string;
|
|
718
|
+
}) => string;
|
|
719
|
+
readonly fix: (p: {
|
|
720
|
+
builder: string;
|
|
721
|
+
}) => string;
|
|
722
|
+
readonly docs: false;
|
|
723
|
+
};
|
|
724
|
+
readonly NUXT_B1019: {
|
|
725
|
+
readonly why: (p: {
|
|
726
|
+
mode: string;
|
|
727
|
+
}) => string;
|
|
728
|
+
readonly fix: "If you are a module author, ensure the component `mode` is set to `client`, `server`, or `all`. Otherwise, please report this issue.";
|
|
729
|
+
readonly docs: false;
|
|
730
|
+
};
|
|
731
|
+
readonly NUXT_B1020: {
|
|
732
|
+
readonly why: "`experimental.watcher: \"builder\"` is set but the active builder does not implement `setupWatcher`. Falling back to the default file watcher.";
|
|
733
|
+
readonly fix: "Remove `experimental.watcher` from your `nuxt.config`, or use a builder that supports its own watcher.";
|
|
734
|
+
readonly docs: false;
|
|
735
|
+
};
|
|
736
|
+
}, readonly [import("nostics").DiagnosticReporter<{
|
|
737
|
+
method?: import("nostics").ConsoleMethod;
|
|
738
|
+
}>]>;
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/diagnostics/plugins.d.ts
|
|
741
|
+
/**
|
|
742
|
+
* B2xxx
|
|
743
|
+
* Plugin diagnostics (`addPlugin`, plugin metadata, plugin ordering).
|
|
744
|
+
*
|
|
745
|
+
* @internal
|
|
746
|
+
*/
|
|
747
|
+
declare const pluginDiagnostics: import("nostics").Diagnostics<{
|
|
748
|
+
readonly NUXT_B2001: {
|
|
749
|
+
readonly why: (p: {
|
|
750
|
+
type: string;
|
|
751
|
+
name: string;
|
|
752
|
+
}) => string;
|
|
753
|
+
readonly fix: "Pass an object literal as the second argument, e.g. `defineNuxtPlugin(() => {}, { name: 'my-plugin' })`.";
|
|
754
|
+
readonly docs: false;
|
|
755
|
+
};
|
|
756
|
+
readonly NUXT_B2002: {
|
|
757
|
+
readonly why: "Plugin options contain spread elements or computed keys, which are not supported.";
|
|
758
|
+
readonly fix: "Use static properties instead.";
|
|
759
|
+
readonly docs: false;
|
|
760
|
+
};
|
|
761
|
+
readonly NUXT_B2003: {
|
|
762
|
+
readonly why: "`dependsOn` is not an array of string literals.";
|
|
763
|
+
readonly fix: "Use string literals in the `dependsOn` array, e.g. `dependsOn: ['my-plugin']`.";
|
|
764
|
+
readonly docs: false;
|
|
765
|
+
};
|
|
766
|
+
readonly NUXT_B2004: {
|
|
767
|
+
readonly why: (p: {
|
|
768
|
+
src: string;
|
|
769
|
+
}) => string;
|
|
770
|
+
readonly fix: "Add content to the plugin file, or remove it from the `plugins/` directory.";
|
|
771
|
+
readonly docs: false;
|
|
772
|
+
};
|
|
773
|
+
readonly NUXT_B2005: {
|
|
774
|
+
readonly why: (p: {
|
|
775
|
+
src: string;
|
|
776
|
+
}) => string;
|
|
777
|
+
readonly fix: "Add `export default defineNuxtPlugin(() => {})` to your plugin.";
|
|
778
|
+
readonly docs: false;
|
|
779
|
+
};
|
|
780
|
+
readonly NUXT_B2006: {
|
|
781
|
+
readonly why: (p: {
|
|
782
|
+
src: string;
|
|
783
|
+
}) => string;
|
|
784
|
+
readonly fix: "Check the plugin file for syntax errors.";
|
|
785
|
+
readonly docs: false;
|
|
786
|
+
};
|
|
787
|
+
readonly NUXT_B2007: {
|
|
788
|
+
readonly why: (p: {
|
|
789
|
+
src: string;
|
|
790
|
+
}) => string;
|
|
791
|
+
readonly fix: "Wrap your plugin with `defineNuxtPlugin`. This may enable enhancements in future.";
|
|
792
|
+
readonly docs: false;
|
|
793
|
+
};
|
|
794
|
+
readonly NUXT_B2008: {
|
|
795
|
+
readonly why: (p: {
|
|
796
|
+
name: string;
|
|
797
|
+
missing: string;
|
|
798
|
+
}) => string;
|
|
799
|
+
readonly fix: "Register the missing dependency plugins, or remove them from the `dependsOn` array.";
|
|
800
|
+
readonly docs: false;
|
|
801
|
+
};
|
|
802
|
+
readonly NUXT_B2009: {
|
|
803
|
+
readonly why: (p: {
|
|
804
|
+
cycle: string;
|
|
805
|
+
}) => string;
|
|
806
|
+
readonly fix: "Restructure the plugin `dependsOn` declarations to break the cycle.";
|
|
807
|
+
readonly docs: false;
|
|
808
|
+
};
|
|
809
|
+
readonly NUXT_B2010: {
|
|
810
|
+
readonly why: (p: {
|
|
811
|
+
src: string;
|
|
812
|
+
}) => string;
|
|
813
|
+
readonly fix: "Use an object literal with static values as the second argument to `defineNuxtPlugin()`, and check the plugin file for syntax errors or unsupported constructs in the metadata.";
|
|
814
|
+
readonly docs: false;
|
|
815
|
+
};
|
|
816
|
+
readonly NUXT_B2011: {
|
|
817
|
+
readonly why: (p: {
|
|
818
|
+
src: string;
|
|
819
|
+
}) => string;
|
|
820
|
+
readonly fix: "Pass a string path, or an object with a `src` property, to `addPlugin()`.";
|
|
821
|
+
readonly docs: false;
|
|
822
|
+
};
|
|
823
|
+
readonly NUXT_B2012: {
|
|
824
|
+
readonly why: (p: {
|
|
825
|
+
name: string;
|
|
826
|
+
dependencies: string[];
|
|
827
|
+
mode: "client" | "server";
|
|
828
|
+
}) => string;
|
|
829
|
+
readonly fix: "Do not depend on plugins that are unavailable in the same build environment; remove them from the `dependsOn` array.";
|
|
830
|
+
readonly docs: false;
|
|
831
|
+
};
|
|
832
|
+
}, readonly [import("nostics").DiagnosticReporter<{
|
|
833
|
+
method?: import("nostics").ConsoleMethod;
|
|
834
|
+
}>]>;
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/diagnostics/components.d.ts
|
|
837
|
+
/**
|
|
838
|
+
* B3xxx
|
|
839
|
+
* Component diagnostics.
|
|
840
|
+
*
|
|
841
|
+
* @internal
|
|
842
|
+
*/
|
|
843
|
+
declare const componentDiagnostics: import("nostics").Diagnostics<{
|
|
844
|
+
readonly NUXT_B3001: {
|
|
845
|
+
readonly why: (p: {
|
|
846
|
+
dirPath: string;
|
|
847
|
+
}) => string;
|
|
848
|
+
readonly fix: "If this is intentional, remove it from `components.dirs` in your `nuxt.config`.";
|
|
849
|
+
readonly docs: false;
|
|
850
|
+
};
|
|
851
|
+
readonly NUXT_B3002: {
|
|
852
|
+
readonly why: (p: {
|
|
853
|
+
component: string;
|
|
854
|
+
}) => string;
|
|
855
|
+
readonly fix: "Set `experimental.componentIslands` to `true` in your `nuxt.config`, or convert the component to a client component.";
|
|
856
|
+
readonly docs: false;
|
|
857
|
+
};
|
|
858
|
+
readonly NUXT_B3003: {
|
|
859
|
+
readonly why: (p: {
|
|
860
|
+
component: string;
|
|
861
|
+
}) => string;
|
|
862
|
+
readonly fix: "Set `experimental.componentIslands` to `true` in your `nuxt.config`.";
|
|
863
|
+
readonly docs: false;
|
|
864
|
+
};
|
|
865
|
+
readonly NUXT_B3004: {
|
|
866
|
+
readonly why: (p: {
|
|
867
|
+
file: string;
|
|
868
|
+
component: string;
|
|
869
|
+
requiredModule: string;
|
|
870
|
+
}) => string;
|
|
871
|
+
readonly fix: (p: {
|
|
872
|
+
requiredModule: string;
|
|
873
|
+
}) => string;
|
|
874
|
+
readonly docs: false;
|
|
875
|
+
};
|
|
876
|
+
readonly NUXT_B3005: {
|
|
877
|
+
readonly why: (p: {
|
|
878
|
+
component: string;
|
|
879
|
+
file: string;
|
|
880
|
+
}) => string;
|
|
881
|
+
readonly fix: "Use only one hydration strategy attribute (e.g. `hydrate-on-visible` or `hydrate-on-idle`) per component.";
|
|
882
|
+
readonly docs: false;
|
|
883
|
+
};
|
|
884
|
+
readonly NUXT_B3006: {
|
|
885
|
+
readonly why: (p: {
|
|
886
|
+
component: string;
|
|
887
|
+
file: string;
|
|
888
|
+
}) => string;
|
|
889
|
+
readonly fix: (p: {
|
|
890
|
+
lazyName: string;
|
|
891
|
+
}) => string;
|
|
892
|
+
readonly docs: false;
|
|
893
|
+
};
|
|
894
|
+
readonly NUXT_B3007: {
|
|
895
|
+
readonly why: (p: {
|
|
896
|
+
file: string;
|
|
897
|
+
}) => string;
|
|
898
|
+
readonly fix: "Set `experimental.componentIslands.selectiveClient` to `true` in your `nuxt.config`.";
|
|
899
|
+
readonly docs: false;
|
|
900
|
+
};
|
|
901
|
+
readonly NUXT_B3008: {
|
|
902
|
+
readonly why: (p: {
|
|
903
|
+
scannedPath: string;
|
|
904
|
+
}) => string;
|
|
905
|
+
readonly fix: (p: {
|
|
906
|
+
scannedPath: string;
|
|
907
|
+
expectedPath: string;
|
|
908
|
+
}) => string;
|
|
909
|
+
readonly docs: false;
|
|
910
|
+
};
|
|
911
|
+
readonly NUXT_B3009: {
|
|
912
|
+
readonly why: (p: {
|
|
913
|
+
component: string;
|
|
914
|
+
filePath: string;
|
|
915
|
+
}) => string;
|
|
916
|
+
readonly fix: "Rename the component to avoid the `Lazy` prefix.";
|
|
917
|
+
readonly docs: false;
|
|
918
|
+
};
|
|
919
|
+
readonly NUXT_B3010: {
|
|
920
|
+
readonly why: (p: {
|
|
921
|
+
filePath: string;
|
|
922
|
+
}) => string;
|
|
923
|
+
readonly fix: "Rename the component file to something other than `index` (e.g. `MyComponent.vue`).";
|
|
924
|
+
readonly docs: false;
|
|
925
|
+
};
|
|
926
|
+
readonly NUXT_B3011: {
|
|
927
|
+
readonly why: (p: {
|
|
928
|
+
component: string;
|
|
929
|
+
filePath: string;
|
|
930
|
+
duplicatePath: string;
|
|
931
|
+
}) => string;
|
|
932
|
+
readonly fix: "Rename one of the files or adjust the `components.dirs` prefix settings in your `nuxt.config`.";
|
|
933
|
+
readonly docs: false;
|
|
934
|
+
};
|
|
935
|
+
readonly NUXT_B3012: {
|
|
936
|
+
readonly why: (p: {
|
|
937
|
+
name: string;
|
|
938
|
+
}) => string;
|
|
939
|
+
readonly fix: "Specify a `priority` option when calling `addComponent` to avoid this warning.";
|
|
940
|
+
readonly docs: false;
|
|
941
|
+
};
|
|
942
|
+
readonly NUXT_B3013: {
|
|
943
|
+
readonly why: (p: {
|
|
944
|
+
file: string;
|
|
945
|
+
}) => string;
|
|
946
|
+
readonly fix: "Switch to the Vite builder with `builder: 'vite'` in your `nuxt.config`.";
|
|
947
|
+
readonly docs: false;
|
|
948
|
+
};
|
|
949
|
+
}, readonly [import("nostics").DiagnosticReporter<{
|
|
950
|
+
method?: import("nostics").ConsoleMethod;
|
|
951
|
+
}>]>;
|
|
952
|
+
//#endregion
|
|
953
|
+
//#region src/diagnostics/pages.d.ts
|
|
954
|
+
/**
|
|
955
|
+
* B4xxx
|
|
956
|
+
* Pages / routing diagnostics.
|
|
957
|
+
*
|
|
958
|
+
* @internal
|
|
959
|
+
*/
|
|
960
|
+
declare const pageDiagnostics: import("nostics").Diagnostics<{
|
|
961
|
+
readonly NUXT_B4001: {
|
|
962
|
+
readonly why: (p: {
|
|
963
|
+
pathname: string;
|
|
964
|
+
}) => string;
|
|
965
|
+
readonly fix: "Add a `<template>` block to the page file, or remove the empty file from the `pages/` directory.";
|
|
966
|
+
readonly docs: false;
|
|
967
|
+
};
|
|
968
|
+
readonly NUXT_B4002: {
|
|
969
|
+
readonly why: "An `await` expression is used in a variable referenced by `definePageMeta`, which runs synchronously.";
|
|
970
|
+
readonly fix: (p: {
|
|
971
|
+
codeSnippet: string;
|
|
972
|
+
offset: number;
|
|
973
|
+
}) => string;
|
|
974
|
+
readonly docs: false;
|
|
975
|
+
};
|
|
976
|
+
readonly NUXT_B4003: {
|
|
977
|
+
readonly why: (p: {
|
|
978
|
+
callCount: number;
|
|
979
|
+
file: string;
|
|
980
|
+
}) => string;
|
|
981
|
+
readonly fix: "Merge all `definePageMeta()` calls into a single call.";
|
|
982
|
+
readonly docs: false;
|
|
983
|
+
};
|
|
984
|
+
readonly NUXT_B4004: {
|
|
985
|
+
readonly why: (p: {
|
|
986
|
+
file: string;
|
|
987
|
+
existingFile: string;
|
|
988
|
+
}) => string;
|
|
989
|
+
readonly fix: "Set a custom name using `definePageMeta` within one of the page files.";
|
|
990
|
+
readonly docs: false;
|
|
991
|
+
};
|
|
992
|
+
readonly NUXT_B4005: {
|
|
993
|
+
readonly why: (p: {
|
|
994
|
+
fnName: string;
|
|
995
|
+
file: string;
|
|
996
|
+
receivedType: string;
|
|
997
|
+
}) => string;
|
|
998
|
+
readonly fix: (p: {
|
|
999
|
+
fnName: string;
|
|
1000
|
+
}) => string;
|
|
1001
|
+
readonly docs: false;
|
|
1002
|
+
};
|
|
1003
|
+
readonly NUXT_B4006: {
|
|
1004
|
+
readonly why: (p: {
|
|
1005
|
+
fnName: string;
|
|
1006
|
+
file: string;
|
|
1007
|
+
}) => string;
|
|
1008
|
+
readonly fix: "Use only JSON-serializable values (strings, numbers, booleans, arrays, plain objects) in `defineRouteRules()`.";
|
|
1009
|
+
readonly docs: false;
|
|
1010
|
+
};
|
|
1011
|
+
readonly NUXT_B4008: {
|
|
1012
|
+
readonly why: "Server pages with `ssr: false` are not supported while component islands are auto-detected.";
|
|
1013
|
+
readonly fix: "Set `experimental.componentIslands` to `true`.";
|
|
1014
|
+
readonly docs: false;
|
|
1015
|
+
};
|
|
1016
|
+
readonly NUXT_B4009: {
|
|
1017
|
+
readonly why: (p: {
|
|
1018
|
+
file: string;
|
|
1019
|
+
}) => string;
|
|
1020
|
+
readonly fix: "Rename the layout file to something other than `index` (e.g. `layouts/default.vue`).";
|
|
1021
|
+
readonly docs: false;
|
|
1022
|
+
};
|
|
1023
|
+
readonly NUXT_B4010: {
|
|
1024
|
+
readonly why: (p: {
|
|
1025
|
+
file: string;
|
|
1026
|
+
}) => string;
|
|
1027
|
+
readonly fix: "Rename the middleware file to something other than `index` (e.g. `middleware/auth.ts`).";
|
|
1028
|
+
readonly docs: false;
|
|
1029
|
+
};
|
|
1030
|
+
readonly NUXT_B4011: {
|
|
1031
|
+
readonly why: (p: {
|
|
1032
|
+
message: string;
|
|
1033
|
+
}) => string;
|
|
1034
|
+
readonly fix: "Check the page file naming and directory structure for issues.";
|
|
1035
|
+
readonly docs: false;
|
|
1036
|
+
};
|
|
1037
|
+
readonly NUXT_B4012: {
|
|
1038
|
+
readonly why: (p: {
|
|
1039
|
+
event: string;
|
|
1040
|
+
path: string;
|
|
1041
|
+
}) => string;
|
|
1042
|
+
readonly fix: "This is usually harmless: the full rebuild will recover. If it happens repeatedly, check for unusual file naming in `pages/`.";
|
|
1043
|
+
readonly docs: false;
|
|
1044
|
+
};
|
|
1045
|
+
readonly NUXT_B4013: {
|
|
1046
|
+
readonly why: (p: {
|
|
1047
|
+
name: string;
|
|
1048
|
+
foundPath: string;
|
|
1049
|
+
}) => string;
|
|
1050
|
+
readonly fix: "Set `override: true` to replace it.";
|
|
1051
|
+
readonly docs: false;
|
|
1052
|
+
};
|
|
1053
|
+
readonly NUXT_B4014: {
|
|
1054
|
+
readonly why: (p: {
|
|
1055
|
+
layoutName: string;
|
|
1056
|
+
existingPath: string;
|
|
1057
|
+
newPath: string;
|
|
1058
|
+
}) => string;
|
|
1059
|
+
readonly fix: "Rename one of the layouts, or remove the duplicate layout registration.";
|
|
1060
|
+
readonly docs: false;
|
|
1061
|
+
};
|
|
1062
|
+
readonly NUXT_B4016: {
|
|
1063
|
+
readonly why: (p: {
|
|
1064
|
+
path: string;
|
|
1065
|
+
detail: string;
|
|
1066
|
+
}) => string;
|
|
1067
|
+
readonly fix: "Define the affected route rules explicitly in `nitro.routeRules`.";
|
|
1068
|
+
readonly docs: false;
|
|
1069
|
+
};
|
|
1070
|
+
readonly NUXT_B4017: {
|
|
1071
|
+
readonly why: (p: {
|
|
1072
|
+
path: string;
|
|
1073
|
+
pattern: string;
|
|
1074
|
+
}) => string;
|
|
1075
|
+
readonly fix: "The later inline route rules override the earlier ones. Use distinct routes, or define the rules explicitly in `nitro.routeRules`.";
|
|
1076
|
+
readonly docs: false;
|
|
1077
|
+
};
|
|
1078
|
+
}, readonly [import("nostics").DiagnosticReporter<{
|
|
1079
|
+
method?: import("nostics").ConsoleMethod;
|
|
1080
|
+
}>]>;
|
|
1081
|
+
//#endregion
|
|
1082
|
+
//#region src/diagnostics/config.d.ts
|
|
1083
|
+
/**
|
|
1084
|
+
* B5xxx
|
|
1085
|
+
* Configuration diagnostics.
|
|
1086
|
+
*
|
|
1087
|
+
* @internal
|
|
1088
|
+
*/
|
|
1089
|
+
declare const configDiagnostics: import("nostics").Diagnostics<{
|
|
1090
|
+
readonly NUXT_B5001: {
|
|
1091
|
+
readonly why: (p: {
|
|
1092
|
+
fallback: string;
|
|
1093
|
+
}) => string;
|
|
1094
|
+
readonly fix: (p: {
|
|
1095
|
+
latest: string;
|
|
1096
|
+
}) => string;
|
|
1097
|
+
};
|
|
1098
|
+
readonly NUXT_B5002: {
|
|
1099
|
+
readonly why: (p: {
|
|
1100
|
+
rootDir: string;
|
|
1101
|
+
}) => string;
|
|
1102
|
+
readonly fix: "Install it manually with `npm install -D @nuxt/webpack-builder`, or change the `builder` option to `vite` in `nuxt.config`.";
|
|
1103
|
+
readonly docs: false;
|
|
1104
|
+
};
|
|
1105
|
+
readonly NUXT_B5003: {
|
|
1106
|
+
readonly why: (p: {
|
|
1107
|
+
key: string;
|
|
1108
|
+
}) => string;
|
|
1109
|
+
readonly fix: "Move the key to `runtimeConfig.public` or a custom namespace.";
|
|
1110
|
+
};
|
|
1111
|
+
readonly NUXT_B5004: {
|
|
1112
|
+
readonly why: (p: {
|
|
1113
|
+
files: string;
|
|
1114
|
+
}) => string;
|
|
1115
|
+
readonly fix: "Move these configurations into `nuxt.config.ts` and delete the external config files.";
|
|
1116
|
+
};
|
|
1117
|
+
readonly NUXT_B5005: {
|
|
1118
|
+
readonly why: (p: {
|
|
1119
|
+
filePath: string;
|
|
1120
|
+
}) => string;
|
|
1121
|
+
readonly fix: "Ensure the file exports a valid object with `defineNuxtSchema()` or as a plain object.";
|
|
1122
|
+
readonly docs: false;
|
|
1123
|
+
};
|
|
1124
|
+
readonly NUXT_B5006: {
|
|
1125
|
+
readonly why: (p: {
|
|
1126
|
+
option: string;
|
|
1127
|
+
}) => string;
|
|
1128
|
+
readonly fix: "Remove the hash option from your webpack config.";
|
|
1129
|
+
readonly docs: false;
|
|
1130
|
+
};
|
|
1131
|
+
readonly NUXT_B5007: {
|
|
1132
|
+
readonly why: "The webpack server config `target` is not set to \"node\".";
|
|
1133
|
+
readonly fix: "Set `target: \"node\"` in your webpack server configuration.";
|
|
1134
|
+
readonly docs: false;
|
|
1135
|
+
};
|
|
1136
|
+
readonly NUXT_B5009: {
|
|
1137
|
+
readonly why: "`@parcel/watcher` cannot be resolved in your project, so `chokidar` is being used instead.";
|
|
1138
|
+
readonly fix: "Install `@parcel/watcher` for better file watching: `npm install -D @parcel/watcher`.";
|
|
1139
|
+
readonly docs: false;
|
|
1140
|
+
};
|
|
1141
|
+
readonly NUXT_B5010: {
|
|
1142
|
+
readonly why: (p: {
|
|
1143
|
+
names: string;
|
|
1144
|
+
}) => string;
|
|
1145
|
+
readonly fix: (p: {
|
|
1146
|
+
install: string;
|
|
1147
|
+
}) => string;
|
|
1148
|
+
readonly docs: false;
|
|
1149
|
+
};
|
|
1150
|
+
readonly NUXT_B5011: {
|
|
1151
|
+
readonly why: (p: {
|
|
1152
|
+
name: string;
|
|
1153
|
+
}) => string;
|
|
1154
|
+
readonly fix: (p: {
|
|
1155
|
+
name: string;
|
|
1156
|
+
}) => string;
|
|
1157
|
+
readonly docs: false;
|
|
1158
|
+
};
|
|
1159
|
+
}, readonly [import("nostics").DiagnosticReporter<{
|
|
1160
|
+
method?: import("nostics").ConsoleMethod;
|
|
1161
|
+
}>]>;
|
|
1162
|
+
//#endregion
|
|
1163
|
+
//#region src/diagnostics/head.d.ts
|
|
1164
|
+
/**
|
|
1165
|
+
* B6xxx
|
|
1166
|
+
* Head / auto-import diagnostics.
|
|
1167
|
+
*
|
|
1168
|
+
* @internal
|
|
1169
|
+
*/
|
|
1170
|
+
declare const headDiagnostics: import("nostics").Diagnostics<{
|
|
1171
|
+
readonly NUXT_B6001: {
|
|
1172
|
+
readonly why: (p: {
|
|
1173
|
+
module: string;
|
|
1174
|
+
file: string;
|
|
1175
|
+
}) => string;
|
|
1176
|
+
readonly fix: "Import from `#imports` instead.";
|
|
1177
|
+
readonly docs: false;
|
|
1178
|
+
};
|
|
1179
|
+
readonly NUXT_B6002: {
|
|
1180
|
+
readonly why: (p: {
|
|
1181
|
+
name: string;
|
|
1182
|
+
}) => string;
|
|
1183
|
+
readonly fix: (p: {
|
|
1184
|
+
name: string;
|
|
1185
|
+
file: string;
|
|
1186
|
+
}) => string;
|
|
1187
|
+
readonly docs: false;
|
|
1188
|
+
};
|
|
1189
|
+
readonly NUXT_B6003: {
|
|
1190
|
+
readonly why: "`unhead.legacy` is deprecated and will be removed.";
|
|
1191
|
+
readonly fix: "Remove deprecated head patterns (`hid`, `vmid`, `children`, `body: true`) and resolve promise values before passing them to `useHead`.";
|
|
1192
|
+
readonly docs: false;
|
|
1193
|
+
};
|
|
1194
|
+
readonly NUXT_B6004: {
|
|
1195
|
+
readonly why: "`experimental.headNext` is deprecated. CAPO sorting is now the default.";
|
|
1196
|
+
readonly fix: "Remove `experimental.headNext` from your `nuxt.config`, or set `unhead.legacy: true` to opt out temporarily.";
|
|
1197
|
+
readonly docs: false;
|
|
1198
|
+
};
|
|
1199
|
+
readonly NUXT_B6005: {
|
|
1200
|
+
readonly why: (p: {
|
|
1201
|
+
name: string;
|
|
1202
|
+
from: string;
|
|
1203
|
+
}) => string;
|
|
1204
|
+
readonly fix: "Check the `from` path in `imports.presets` (or the module that registered this import). Auto-imports from an unresolvable module are silently skipped and can surface as unrelated type errors elsewhere.";
|
|
1205
|
+
readonly docs: false;
|
|
1206
|
+
};
|
|
1207
|
+
}, readonly [import("nostics").DiagnosticReporter<{
|
|
1208
|
+
method?: import("nostics").ConsoleMethod;
|
|
1209
|
+
}>]>;
|
|
1210
|
+
//#endregion
|
|
1211
|
+
//#region src/diagnostics/bundler.d.ts
|
|
1212
|
+
/**
|
|
1213
|
+
* B7xxx
|
|
1214
|
+
* Bundler (Vite / webpack / Nitro) diagnostics.
|
|
1215
|
+
*
|
|
1216
|
+
* @internal
|
|
1217
|
+
*/
|
|
1218
|
+
declare const bundlerDiagnostics: import("nostics").Diagnostics<{
|
|
1219
|
+
readonly NUXT_B7001: {
|
|
1220
|
+
readonly why: "`rollup-plugin-visualizer` is not installed, so bundle analysis cannot run.";
|
|
1221
|
+
readonly fix: "Run `npm install -D rollup-plugin-visualizer` to enable bundle analysis.";
|
|
1222
|
+
readonly docs: false;
|
|
1223
|
+
};
|
|
1224
|
+
readonly NUXT_B7002: {
|
|
1225
|
+
readonly why: (p: {
|
|
1226
|
+
deps: string;
|
|
1227
|
+
}) => string;
|
|
1228
|
+
readonly fix: "Remove or correct these entries in the `vite.optimizeDeps.include` array of your `nuxt.config.ts`. Report entries added by a Nuxt module to the module author.";
|
|
1229
|
+
readonly docs: false;
|
|
1230
|
+
};
|
|
1231
|
+
readonly NUXT_B7003: {
|
|
1232
|
+
readonly why: "The server-side bundle produced more than one JS entry file.";
|
|
1233
|
+
readonly fix: "Avoid using `optimization.splitChunks` in the server config.";
|
|
1234
|
+
readonly docs: false;
|
|
1235
|
+
};
|
|
1236
|
+
readonly NUXT_B7004: {
|
|
1237
|
+
readonly why: (p: {
|
|
1238
|
+
entryName: string;
|
|
1239
|
+
}) => string;
|
|
1240
|
+
readonly fix: (p: {
|
|
1241
|
+
entryName: string;
|
|
1242
|
+
}) => string;
|
|
1243
|
+
readonly docs: false;
|
|
1244
|
+
};
|
|
1245
|
+
readonly NUXT_B7005: {
|
|
1246
|
+
readonly why: (p: {
|
|
1247
|
+
input: string;
|
|
1248
|
+
}) => string;
|
|
1249
|
+
readonly fix: "Set `vite.build.rollupOptions.input` to a string or an object with an `entry` key in your `nuxt.config`.";
|
|
1250
|
+
readonly docs: false;
|
|
1251
|
+
};
|
|
1252
|
+
readonly NUXT_B7006: {
|
|
1253
|
+
readonly why: (p: {
|
|
1254
|
+
input: string;
|
|
1255
|
+
}) => string;
|
|
1256
|
+
readonly fix: "Set `vite.build.rollupOptions.input` to a string or an object with a `server` key in your `nuxt.config`.";
|
|
1257
|
+
readonly docs: false;
|
|
1258
|
+
};
|
|
1259
|
+
readonly NUXT_B7007: {
|
|
1260
|
+
readonly why: (p: {
|
|
1261
|
+
pluginName: string;
|
|
1262
|
+
}) => string;
|
|
1263
|
+
readonly fix: (p: {
|
|
1264
|
+
pluginName: string;
|
|
1265
|
+
}) => string;
|
|
1266
|
+
readonly docs: false;
|
|
1267
|
+
};
|
|
1268
|
+
readonly NUXT_B7008: {
|
|
1269
|
+
readonly why: "`@vitejs/plugin-vue-jsx` is not installed, so JSX support is unavailable.";
|
|
1270
|
+
readonly fix: "Run `npm install -D @vitejs/plugin-vue-jsx` to install it.";
|
|
1271
|
+
readonly docs: false;
|
|
1272
|
+
};
|
|
1273
|
+
readonly NUXT_B7009: {
|
|
1274
|
+
readonly why: (p: {
|
|
1275
|
+
deps: string;
|
|
1276
|
+
}) => string;
|
|
1277
|
+
readonly fix: (p: {
|
|
1278
|
+
install: string;
|
|
1279
|
+
}) => string;
|
|
1280
|
+
readonly docs: false;
|
|
1281
|
+
};
|
|
1282
|
+
readonly NUXT_B7011: {
|
|
1283
|
+
readonly why: (p: {
|
|
1284
|
+
pluginName: string;
|
|
1285
|
+
}) => string;
|
|
1286
|
+
readonly fix: (p: {
|
|
1287
|
+
pluginName: string;
|
|
1288
|
+
}) => string;
|
|
1289
|
+
readonly docs: false;
|
|
1290
|
+
};
|
|
1291
|
+
readonly NUXT_B7012: {
|
|
1292
|
+
readonly why: (p: {
|
|
1293
|
+
requiredSize: number;
|
|
1294
|
+
maxSize: number;
|
|
1295
|
+
}) => string;
|
|
1296
|
+
readonly fix: "Reduce the payload size sent through the ViteNode socket.";
|
|
1297
|
+
readonly docs: false;
|
|
1298
|
+
};
|
|
1299
|
+
readonly NUXT_B7013: {
|
|
1300
|
+
readonly why: "The ViteNode socket server was started without a configured socket path.";
|
|
1301
|
+
readonly fix: "This is likely an internal Nuxt bug. Please report it at https://github.com/nuxt/nuxt/issues.";
|
|
1302
|
+
readonly docs: false;
|
|
1303
|
+
};
|
|
1304
|
+
readonly NUXT_B7014: {
|
|
1305
|
+
readonly why: (p: {
|
|
1306
|
+
name: string;
|
|
1307
|
+
}) => string;
|
|
1308
|
+
readonly fix: "Fix the build errors listed above. If the errors are unclear, try running `nuxt cleanup` and rebuilding.";
|
|
1309
|
+
readonly docs: false;
|
|
1310
|
+
};
|
|
1311
|
+
readonly NUXT_B7015: {
|
|
1312
|
+
readonly why: "Payload extraction is disabled, which is suboptimal for full-static output.";
|
|
1313
|
+
readonly fix: "Set `experimental.payloadExtraction` to `true` or `'client'`.";
|
|
1314
|
+
readonly docs: false;
|
|
1315
|
+
};
|
|
1316
|
+
readonly NUXT_B7016: {
|
|
1317
|
+
readonly why: (p: {
|
|
1318
|
+
path: string;
|
|
1319
|
+
}) => string;
|
|
1320
|
+
readonly fix: "Point `spaLoadingTemplate` in `nuxt.config` at an existing HTML file, or set it to `true` to use the default template.";
|
|
1321
|
+
readonly docs: false;
|
|
1322
|
+
};
|
|
1323
|
+
readonly NUXT_B7017: {
|
|
1324
|
+
readonly why: "Could not find the Nuxt dev server to attach Rspack HMR to; hot module replacement will be disabled.";
|
|
1325
|
+
readonly fix: "This is likely an internal Nuxt bug. Please report it with a reproduction.";
|
|
1326
|
+
readonly docs: false;
|
|
1327
|
+
};
|
|
1328
|
+
readonly NUXT_B7018: {
|
|
1329
|
+
readonly why: "Failed to restrict vite-node socket permissions; closing the socket.";
|
|
1330
|
+
readonly fix: "Check that the temporary directory used for the vite-node socket is writable and supports `chmod`.";
|
|
1331
|
+
readonly docs: false;
|
|
1332
|
+
};
|
|
1333
|
+
readonly NUXT_B7019: {
|
|
1334
|
+
readonly why: "The server webpack build does not externalize dependencies.";
|
|
1335
|
+
readonly fix: "Externalize dependencies in the server build (`externals`) for better build performance.";
|
|
1336
|
+
readonly docs: false;
|
|
1337
|
+
};
|
|
1338
|
+
}, readonly [import("nostics").DiagnosticReporter<{
|
|
1339
|
+
method?: import("nostics").ConsoleMethod;
|
|
1340
|
+
}>]>;
|
|
1341
|
+
//#endregion
|
|
550
1342
|
//#region src/internal/esm.d.ts
|
|
551
1343
|
interface ResolveModuleOptions {
|
|
552
1344
|
/** @deprecated use `url` with URLs pointing at a file - never a directory */
|
|
553
1345
|
paths?: string | string[];
|
|
554
1346
|
url?: URL | URL[];
|
|
555
|
-
/** @default ['.
|
|
1347
|
+
/** @default ['.mjs', '.js', '.cjs', '.mts', '.ts', '.cts', '.tsx', '.jsx'] */
|
|
556
1348
|
extensions?: string[];
|
|
557
1349
|
}
|
|
558
1350
|
declare function directoryToURL(dir: string): URL;
|
|
559
1351
|
/**
|
|
560
|
-
* Resolve a module from a given root path using an algorithm patterned on
|
|
561
|
-
* the upcoming `import.meta.resolve`. It returns a file URL
|
|
562
|
-
*
|
|
563
|
-
* @internal
|
|
564
|
-
*/
|
|
1352
|
+
* Resolve a module from a given root path using an algorithm patterned on
|
|
1353
|
+
* the upcoming `import.meta.resolve`. It returns a file URL
|
|
1354
|
+
*
|
|
1355
|
+
* @internal
|
|
1356
|
+
*/
|
|
565
1357
|
declare function tryResolveModule(id: string, url: URL | URL[]): Promise<string | undefined>;
|
|
566
1358
|
/** @deprecated pass URLs pointing at files */
|
|
567
1359
|
declare function tryResolveModule(id: string, url: string | string[]): Promise<string | undefined>;
|
|
@@ -573,12 +1365,12 @@ interface ImportModuleOptions extends ResolveModuleOptions {
|
|
|
573
1365
|
declare function importModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T>;
|
|
574
1366
|
declare function tryImportModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T | undefined> | undefined;
|
|
575
1367
|
/**
|
|
576
|
-
* @deprecated Please use `importModule` instead.
|
|
577
|
-
*/
|
|
1368
|
+
* @deprecated Please use `importModule` instead.
|
|
1369
|
+
*/
|
|
578
1370
|
declare function requireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T;
|
|
579
1371
|
/**
|
|
580
|
-
* @deprecated Please use `tryImportModule` instead.
|
|
581
|
-
*/
|
|
1372
|
+
* @deprecated Please use `tryImportModule` instead.
|
|
1373
|
+
*/
|
|
582
1374
|
declare function tryRequireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T | undefined;
|
|
583
1375
|
//#endregion
|
|
584
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LayerDirectories, type LoadNuxtConfigOptions, type LoadNuxtOptions, type NuxtMajorVersion, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, 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, 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, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
1376
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, DEFAULT_JSX_FILE_EXTENSIONS, DEFAULT_JS_FILE_EXTENSIONS, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LayerDirectories, type LoadNuxtConfigOptions, type LoadNuxtOptions, type NuxtMajorVersion, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, 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, buildDiagnostics, buildNuxt, bundlerDiagnostics, checkNuxtCompatibility, componentDiagnostics, configDiagnostics, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, headDiagnostics, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, packageName, pageDiagnostics, pluginDiagnostics, requireModule, resolveAlias, resolveDeclarationPath, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, resolveTypePaths, runWithNuxtContext, setBuildOutput, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateAppConfig, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|