@nuxt/kit-nightly 4.5.1-29752449.30d24817 → 4.5.2-2610052030-052d82e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +569 -921
- package/dist/index.mjs +1213 -1768
- package/dist/internal/index.d.mts +1153 -0
- package/dist/internal/index.mjs +438 -0
- package/dist/nitro-C_Sq_oVQ.d.mts +136 -0
- package/dist/ohash-Bgte42aT.mjs +277 -0
- package/dist/plugins-BDBHyGmg.mjs +2564 -0
- package/package.json +78 -25
package/dist/index.d.mts
CHANGED
|
@@ -1,48 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { LoadConfigOptions } from "c12";
|
|
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
|
-
import { Configuration, WebpackPluginInstance } from "webpack";
|
|
8
|
-
import { Plugin, UserConfig } from "vite";
|
|
9
|
-
import { Nitro, NitroDevEventHandler, NitroEventHandler, NitroRouteConfig } from "nitropack/types";
|
|
10
|
-
|
|
1
|
+
import { a as addServerHandler, b as resolveModuleWithOptions, c as addServerPlugin, f as resolveServerVariant, g as installModule, h as getDirectory, i as addPrerenderRoutes, l as addServerScanDir, m as useNitro, n as addDevServerHandler, o as addServerImports, p as tryUseNitro, r as addNitroPlugin, s as addServerImportsDir, t as ServerImportInput, v as loadNuxtModuleInstance, y as normalizeModuleTranspilePath } from "./nitro-C_Sq_oVQ.mjs";
|
|
2
|
+
import "exsolve";
|
|
3
|
+
import { Component, ComponentsDir, ModuleDefinition, ModuleOptions, NitroInstance, NitroInstanceOptions, Nuxt, NuxtAppConfig, NuxtBuildOutputs, NuxtCompatibility, NuxtCompatibilityIssues, NuxtConfig, NuxtConfigLayer, NuxtConfigLayerMeta, NuxtDotenvOptions, NuxtHooks, NuxtImport, NuxtImportPresetSource, NuxtMiddleware, NuxtModule, NuxtOptions, NuxtPlugin, NuxtPluginTemplate, NuxtServerTemplate, NuxtTemplate, NuxtTypeTemplate, ResolvedNuxtTemplate, SchemaDefinition, ViteConfig, VitePlugin, WebpackConfig, WebpackPluginInstance } from "@nuxt/schema";
|
|
11
4
|
//#region src/module/define.d.ts
|
|
12
5
|
/**
|
|
13
6
|
* Define a Nuxt module, automatically merging defaults with user provided options, installing
|
|
14
7
|
* any hooks that are provided, and calling an optional setup function for full control.
|
|
15
8
|
*/
|
|
16
|
-
declare function defineNuxtModule<TOptions extends ModuleOptions>(definition: ModuleDefinition<TOptions, Partial<TOptions>, false> | NuxtModule<TOptions, Partial<TOptions>, false>): NuxtModule<TOptions, TOptions, false>;
|
|
17
|
-
declare function defineNuxtModule<TOptions extends ModuleOptions>(): {
|
|
9
|
+
export declare function defineNuxtModule<TOptions extends ModuleOptions>(definition: ModuleDefinition<TOptions, Partial<TOptions>, false> | NuxtModule<TOptions, Partial<TOptions>, false>): NuxtModule<TOptions, TOptions, false>;
|
|
10
|
+
export declare function defineNuxtModule<TOptions extends ModuleOptions>(): {
|
|
18
11
|
with: <TOptionsDefaults extends Partial<TOptions>>(definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | NuxtModule<TOptions, TOptionsDefaults, true>) => NuxtModule<TOptions, TOptionsDefaults, true>;
|
|
19
12
|
};
|
|
20
13
|
//#endregion
|
|
21
|
-
//#region src/module/install.d.ts
|
|
22
|
-
type ModuleToInstall = string | NuxtModule<ModuleOptions, Partial<ModuleOptions>, false>;
|
|
23
|
-
/**
|
|
24
|
-
* Installs a set of modules on a Nuxt instance.
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
declare function installModules(modulesToInstall: Map<ModuleToInstall, Record<string, any>>, resolvedModulePaths: Set<string>, nuxt?: Nuxt): Promise<void>;
|
|
28
|
-
/**
|
|
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>;
|
|
33
|
-
declare function resolveModuleWithOptions(definition: NuxtModule<any> | string | false | undefined | null | [(NuxtModule | string)?, Record<string, any>?], nuxt: Nuxt): {
|
|
34
|
-
resolvedPath?: string;
|
|
35
|
-
module: string | NuxtModule<any>;
|
|
36
|
-
options: Record<string, any>;
|
|
37
|
-
} | undefined;
|
|
38
|
-
declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{
|
|
39
|
-
nuxtModule: NuxtModule<any>;
|
|
40
|
-
buildTimeModuleMeta: ModuleMeta;
|
|
41
|
-
resolvedModulePath?: string;
|
|
42
|
-
}>;
|
|
43
|
-
declare function getDirectory(p: string): string;
|
|
44
|
-
declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
45
|
-
//#endregion
|
|
46
14
|
//#region src/module/compatibility.d.ts
|
|
47
15
|
/**
|
|
48
16
|
* Check if a Nuxt module is installed by name.
|
|
@@ -50,26 +18,150 @@ declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
|
50
18
|
* This will check both the installed modules and the modules to be installed. Note
|
|
51
19
|
* that it cannot detect if a module is _going to be_ installed programmatically by another module.
|
|
52
20
|
*/
|
|
53
|
-
declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
|
|
21
|
+
export declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
|
|
54
22
|
/**
|
|
55
23
|
* Checks if a Nuxt module is compatible with a given semver version.
|
|
56
24
|
*/
|
|
57
|
-
declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
|
|
25
|
+
export declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
|
|
58
26
|
/**
|
|
59
27
|
* Get the version of a Nuxt module.
|
|
60
28
|
*
|
|
61
29
|
* 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
30
|
*/
|
|
63
|
-
declare function getNuxtModuleVersion(module: string | NuxtModule, nuxt?: Nuxt | any): Promise<string | false>;
|
|
31
|
+
export declare function getNuxtModuleVersion(module: string | NuxtModule, nuxt?: Nuxt | any): Promise<string | false>;
|
|
64
32
|
//#endregion
|
|
65
33
|
//#region src/loader/config.d.ts
|
|
66
|
-
|
|
67
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Context handed to `onConfigResolved` after configuration has loaded successfully.
|
|
36
|
+
*/
|
|
37
|
+
interface ResolvedNuxtConfigContext {
|
|
38
|
+
/**
|
|
39
|
+
* User configuration merged across all layers, with no schema defaults applied and with
|
|
40
|
+
* `overrides`, `defaults` and `defaultConfig` from the load options excluded, so repeated
|
|
41
|
+
* loads of an unchanged project produce an unchanged snapshot. Two snapshots from separate
|
|
42
|
+
* `loadNuxtConfig` calls can be compared with `diffNuxtConfig`.
|
|
43
|
+
*/
|
|
44
|
+
rawConfig: NuxtConfig;
|
|
45
|
+
/** Resolved config layers, highest priority first. */
|
|
46
|
+
layers: NuxtConfigLayer[];
|
|
47
|
+
/** Absolute path of the root `nuxt.config` file, if one was found. */
|
|
48
|
+
configFile?: string;
|
|
49
|
+
/** Directory the configuration was loaded from. */
|
|
50
|
+
cwd: string;
|
|
51
|
+
}
|
|
52
|
+
/** A layer produced by a custom {@link LoadNuxtConfigOptions.resolve} implementation. */
|
|
53
|
+
interface ResolvedNuxtLayer {
|
|
54
|
+
/** The layer's configuration. Return an empty object to contribute nothing to the merge. */
|
|
55
|
+
config: NuxtConfig;
|
|
56
|
+
/** Absolute path of the directory the layer was loaded from. */
|
|
57
|
+
cwd?: string;
|
|
58
|
+
/** Absolute path of the layer's config file, if it has one. */
|
|
59
|
+
configFile?: string;
|
|
60
|
+
/** The `extends` entry this layer was resolved from. */
|
|
61
|
+
source?: string;
|
|
62
|
+
/** Metadata to attach to the layer. */
|
|
63
|
+
meta?: NuxtConfigLayerMeta;
|
|
64
|
+
}
|
|
65
|
+
/** Context passed to a custom {@link LoadNuxtConfigOptions.resolve} implementation. */
|
|
66
|
+
interface NuxtLayerResolverContext {
|
|
67
|
+
/** Directory the layer source should be resolved relative to. */
|
|
68
|
+
cwd?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The importer in use for the current load, if one has been established. Pass it to any
|
|
71
|
+
* nested load so a layer is not loaded through a second, differently configured importer.
|
|
72
|
+
*/
|
|
73
|
+
import?: (id: string) => Promise<unknown>;
|
|
68
74
|
}
|
|
69
|
-
|
|
75
|
+
interface LoadNuxtConfigOptions {
|
|
76
|
+
/** Directory to load `nuxt.config` from. @default process.cwd() */
|
|
77
|
+
cwd?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Name of the config file to load, without an extension.
|
|
80
|
+
* @default 'nuxt.config'
|
|
81
|
+
*/
|
|
82
|
+
configFile?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Name of the `.rc` file to load alongside the config file, or `false` to load none.
|
|
85
|
+
* @default '.nuxtrc'
|
|
86
|
+
*/
|
|
87
|
+
rcFile?: string | false;
|
|
88
|
+
/**
|
|
89
|
+
* Also load the user-level and workspace-level `.nuxtrc` files.
|
|
90
|
+
* @default true
|
|
91
|
+
*/
|
|
92
|
+
globalRc?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Configuration applied above every layer, including the root project's own `nuxt.config`.
|
|
95
|
+
* Excluded from the `rawConfig` snapshot passed to `onConfigResolved`.
|
|
96
|
+
*/
|
|
97
|
+
overrides?: NuxtConfig;
|
|
98
|
+
/**
|
|
99
|
+
* Configuration applied below every layer, before schema defaults. Excluded from the
|
|
100
|
+
* `rawConfig` snapshot passed to `onConfigResolved`.
|
|
101
|
+
*/
|
|
102
|
+
defaults?: NuxtConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Load `.env` files into `process.env` before resolving configuration. Set to `false` when
|
|
105
|
+
* the environment has already been populated.
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
dotenv?: boolean | NuxtDotenvOptions;
|
|
109
|
+
/**
|
|
110
|
+
* Environment name used to select `$env.*` configuration overrides. Takes precedence over
|
|
111
|
+
* `envName` set in `nuxt.config`.
|
|
112
|
+
*/
|
|
113
|
+
envName?: string | false;
|
|
114
|
+
/**
|
|
115
|
+
* Resolve an `extends` entry to a layer yourself. Return a nullish value to fall back to the
|
|
116
|
+
* default resolution for that source.
|
|
117
|
+
*/
|
|
118
|
+
resolve?: (source: string, context: NuxtLayerResolverContext) => ResolvedNuxtLayer | null | undefined | Promise<ResolvedNuxtLayer | null | undefined>;
|
|
119
|
+
/**
|
|
120
|
+
* Import config files with a custom loader rather than the default one. Supply this to load
|
|
121
|
+
* TypeScript config without Nuxt reaching for `jiti`.
|
|
122
|
+
*/
|
|
123
|
+
import?: (id: string) => Promise<unknown>;
|
|
124
|
+
/**
|
|
125
|
+
* Called once, awaited, after configuration has loaded successfully. Callers watching config
|
|
126
|
+
* files themselves can keep the previous `rawConfig` and pass both snapshots to
|
|
127
|
+
* `diffNuxtConfig` to find out which keys changed. Not called if loading throws.
|
|
128
|
+
*/
|
|
129
|
+
onConfigResolved?: (context: ResolvedNuxtConfigContext) => void | Promise<void>;
|
|
130
|
+
}
|
|
131
|
+
interface NuxtConfigDiffLocation {
|
|
132
|
+
/**
|
|
133
|
+
* Property path of the changed value, with array indices as numbers: `['modules']`,
|
|
134
|
+
* `['runtimeConfig', 'public', 'foo']`, `['modules', 0]`. Prefer this over {@link label} when
|
|
135
|
+
* reading the value back out of a config object.
|
|
136
|
+
*/
|
|
137
|
+
path: Array<string | number>;
|
|
138
|
+
/**
|
|
139
|
+
* {@link path} written as a property accessor, for display and for matching against a known
|
|
140
|
+
* key: `ssr`, `runtimeConfig.public.foo`, `modules[0]`, `nitro.routeRules["/index.html"].ssr`.
|
|
141
|
+
*/
|
|
142
|
+
label: string;
|
|
143
|
+
}
|
|
144
|
+
/** A single difference between two resolved Nuxt configurations. */
|
|
145
|
+
type NuxtConfigDiffEntry = (NuxtConfigDiffLocation & {
|
|
146
|
+
type: 'added';
|
|
147
|
+
newValue: unknown;
|
|
148
|
+
}) | (NuxtConfigDiffLocation & {
|
|
149
|
+
type: 'removed';
|
|
150
|
+
oldValue: unknown;
|
|
151
|
+
}) | (NuxtConfigDiffLocation & {
|
|
152
|
+
type: 'changed';
|
|
153
|
+
newValue: unknown;
|
|
154
|
+
oldValue: unknown;
|
|
155
|
+
});
|
|
156
|
+
/**
|
|
157
|
+
* Compare two `rawConfig` snapshots (as provided to `onConfigResolved`) and return the
|
|
158
|
+
* differences between them.
|
|
159
|
+
*/
|
|
160
|
+
export declare function diffNuxtConfig(oldConfig: NuxtConfig, newConfig: NuxtConfig): NuxtConfigDiffEntry[];
|
|
161
|
+
export declare function loadNuxtConfig(opts: LoadNuxtConfigOptions): Promise<NuxtOptions>;
|
|
70
162
|
//#endregion
|
|
71
163
|
//#region src/loader/schema.d.ts
|
|
72
|
-
declare function extendNuxtSchema(def: SchemaDefinition | (() => SchemaDefinition)): void;
|
|
164
|
+
export declare function extendNuxtSchema(def: SchemaDefinition | (() => SchemaDefinition)): void;
|
|
73
165
|
//#endregion
|
|
74
166
|
//#region src/loader/nuxt.d.ts
|
|
75
167
|
interface LoadNuxtOptions extends LoadNuxtConfigOptions {
|
|
@@ -78,14 +170,14 @@ interface LoadNuxtOptions extends LoadNuxtConfigOptions {
|
|
|
78
170
|
/** Use lazy initialization of nuxt if set to false */
|
|
79
171
|
ready?: boolean;
|
|
80
172
|
}
|
|
81
|
-
declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
|
|
82
|
-
declare function buildNuxt(nuxt: Nuxt): Promise<any>;
|
|
173
|
+
export declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
|
|
174
|
+
export declare function buildNuxt(nuxt: Nuxt): Promise<any>;
|
|
83
175
|
//#endregion
|
|
84
176
|
//#region src/layers.d.ts
|
|
85
177
|
interface LayerDirectories {
|
|
86
178
|
/** Nuxt rootDir (`/` by default) */
|
|
87
179
|
readonly root: string;
|
|
88
|
-
/**
|
|
180
|
+
/** Server source directory (`/server` by default) */
|
|
89
181
|
readonly server: string;
|
|
90
182
|
/** Local modules directory (`/modules` by default) */
|
|
91
183
|
readonly modules: string;
|
|
@@ -115,33 +207,24 @@ interface LayerDirectories {
|
|
|
115
207
|
* @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
|
|
116
208
|
* @returns Array of LayerDirectories objects, ordered by priority (user layer first)
|
|
117
209
|
*/
|
|
118
|
-
declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
|
|
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[];
|
|
210
|
+
export declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
|
|
128
211
|
//#endregion
|
|
129
212
|
//#region src/head.d.ts
|
|
130
|
-
declare function setGlobalHead(head: NuxtAppConfig['head']): void;
|
|
213
|
+
export declare function setGlobalHead(head: NuxtAppConfig['head']): void;
|
|
131
214
|
//#endregion
|
|
132
215
|
//#region src/imports.d.ts
|
|
133
|
-
declare function addImports(imports:
|
|
134
|
-
declare function addImportsDir(dirs: string | string[], opts?: {
|
|
216
|
+
export declare function addImports(imports: NuxtImport | NuxtImport[]): void;
|
|
217
|
+
export declare function addImportsDir(dirs: string | string[], opts?: {
|
|
135
218
|
prepend?: boolean;
|
|
136
219
|
}): void;
|
|
137
|
-
declare function addImportsSources(presets:
|
|
220
|
+
export declare function addImportsSources(presets: NuxtImportPresetSource | NuxtImportPresetSource[]): void;
|
|
138
221
|
//#endregion
|
|
139
222
|
//#region src/app-config.d.ts
|
|
140
223
|
/**
|
|
141
224
|
* Update Nuxt app configuration.
|
|
142
225
|
* @since 4.5.0
|
|
143
226
|
*/
|
|
144
|
-
declare function updateAppConfig(appConfig: Record<string, unknown>): void;
|
|
227
|
+
export declare function updateAppConfig(appConfig: Record<string, unknown>): void;
|
|
145
228
|
//#endregion
|
|
146
229
|
//#region src/runtime-config.d.ts
|
|
147
230
|
/**
|
|
@@ -149,11 +232,11 @@ declare function updateAppConfig(appConfig: Record<string, unknown>): void;
|
|
|
149
232
|
*
|
|
150
233
|
* This mirrors the runtime behavior of Nitro.
|
|
151
234
|
*/
|
|
152
|
-
declare function useRuntimeConfig(): Record<string, any>;
|
|
235
|
+
export declare function useRuntimeConfig(): Record<string, any>;
|
|
153
236
|
/**
|
|
154
237
|
* Update Nuxt runtime configuration.
|
|
155
238
|
*/
|
|
156
|
-
declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
|
|
239
|
+
export declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
|
|
157
240
|
//#endregion
|
|
158
241
|
//#region src/build.d.ts
|
|
159
242
|
type Arrayable<T> = T | T[];
|
|
@@ -207,85 +290,98 @@ interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, 'server' | '
|
|
|
207
290
|
*/
|
|
208
291
|
client?: boolean;
|
|
209
292
|
}
|
|
210
|
-
type ExtendWebpacklikeConfig = (fn: (config:
|
|
293
|
+
type ExtendWebpacklikeConfig = (fn: (config: WebpackConfig) => void, options?: ExtendWebpackConfigOptions) => void;
|
|
211
294
|
/**
|
|
212
295
|
* Extend webpack config
|
|
213
296
|
*
|
|
214
297
|
* The fallback function might be called multiple times
|
|
215
298
|
* when applying to both client and server builds.
|
|
216
299
|
*/
|
|
217
|
-
declare const extendWebpackConfig: ExtendWebpacklikeConfig;
|
|
300
|
+
export declare const extendWebpackConfig: ExtendWebpacklikeConfig;
|
|
218
301
|
/**
|
|
219
302
|
* Extend rspack config
|
|
220
303
|
*
|
|
221
304
|
* The fallback function might be called multiple times
|
|
222
305
|
* when applying to both client and server builds.
|
|
223
306
|
*/
|
|
224
|
-
declare const extendRspackConfig: ExtendWebpacklikeConfig;
|
|
307
|
+
export declare const extendRspackConfig: ExtendWebpacklikeConfig;
|
|
225
308
|
/**
|
|
226
309
|
* Extend Vite config
|
|
227
310
|
*/
|
|
228
|
-
declare function extendViteConfig(fn: ((config:
|
|
311
|
+
export declare function extendViteConfig(fn: ((config: ViteConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
|
|
229
312
|
/**
|
|
230
313
|
* Append webpack plugin to the config.
|
|
231
314
|
*/
|
|
232
|
-
declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
315
|
+
export declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
233
316
|
/**
|
|
234
317
|
* Append rspack plugin to the config.
|
|
235
318
|
*/
|
|
236
|
-
declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackCompatiblePluginInstance> | (() => Thenable<Arrayable<RspackCompatiblePluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
319
|
+
export declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackCompatiblePluginInstance> | (() => Thenable<Arrayable<RspackCompatiblePluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
237
320
|
/**
|
|
238
321
|
* Append Vite plugin to the config.
|
|
239
322
|
*/
|
|
240
|
-
declare function addVitePlugin(pluginOrGetter: Arrayable<
|
|
323
|
+
export declare function addVitePlugin(pluginOrGetter: Arrayable<VitePlugin> | (() => Thenable<Arrayable<VitePlugin>>), options?: ExtendConfigOptions): void;
|
|
241
324
|
interface AddBuildPluginFactory {
|
|
242
|
-
vite?: () => Thenable<Arrayable<
|
|
325
|
+
vite?: () => Thenable<Arrayable<VitePlugin>>;
|
|
243
326
|
webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
|
|
244
327
|
rspack?: () => Thenable<Arrayable<RspackCompatiblePluginInstance>>;
|
|
245
328
|
}
|
|
246
|
-
declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
|
|
329
|
+
export declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
|
|
247
330
|
/**
|
|
248
331
|
* Set the build output for the given key. See {@link NuxtBuildOutputs}.
|
|
249
332
|
*/
|
|
250
|
-
declare function setBuildOutput<K extends keyof NuxtBuildOutputs>(key: K, provider: NuxtBuildOutputs[K], nuxt?: Nuxt): void;
|
|
333
|
+
export declare function setBuildOutput<K extends keyof NuxtBuildOutputs>(key: K, provider: NuxtBuildOutputs[K], nuxt?: Nuxt): void;
|
|
251
334
|
//#endregion
|
|
252
335
|
//#region src/compatibility.d.ts
|
|
253
|
-
declare function normalizeSemanticVersion(version: string): string;
|
|
336
|
+
export declare function normalizeSemanticVersion(version: string): string;
|
|
254
337
|
/**
|
|
255
338
|
* Check version constraints and return incompatibility issues as an array
|
|
256
339
|
*/
|
|
257
|
-
declare function checkNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<NuxtCompatibilityIssues>;
|
|
340
|
+
export declare function checkNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<NuxtCompatibilityIssues>;
|
|
258
341
|
/**
|
|
259
342
|
* Check version constraints and throw a detailed error if has any, otherwise returns true
|
|
260
343
|
*/
|
|
261
|
-
declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<true>;
|
|
344
|
+
export declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<true>;
|
|
262
345
|
/**
|
|
263
346
|
* Check version constraints and return true if passed, otherwise returns false
|
|
264
347
|
*/
|
|
265
|
-
declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
|
|
348
|
+
export declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
|
|
266
349
|
type NuxtMajorVersion = 2 | 3 | 4;
|
|
267
350
|
/**
|
|
268
351
|
* Check if current Nuxt instance is of specified major version
|
|
269
352
|
*/
|
|
270
|
-
declare function isNuxtMajorVersion(majorVersion: NuxtMajorVersion, nuxt?: Nuxt): boolean;
|
|
353
|
+
export declare function isNuxtMajorVersion(majorVersion: NuxtMajorVersion, nuxt?: Nuxt): boolean;
|
|
271
354
|
/**
|
|
272
355
|
* @deprecated Use `isNuxtMajorVersion(2, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
273
356
|
*/
|
|
274
|
-
declare function isNuxt2(nuxt?: Nuxt): boolean;
|
|
357
|
+
export declare function isNuxt2(nuxt?: Nuxt): boolean;
|
|
275
358
|
/**
|
|
276
359
|
* @deprecated Use `isNuxtMajorVersion(3, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
277
360
|
*/
|
|
278
|
-
declare function isNuxt3(nuxt?: Nuxt): boolean;
|
|
361
|
+
export declare function isNuxt3(nuxt?: Nuxt): boolean;
|
|
362
|
+
/**
|
|
363
|
+
* Get the major version of nitro used by the current Nuxt instance.
|
|
364
|
+
*
|
|
365
|
+
* Resolution order:
|
|
366
|
+
*
|
|
367
|
+
* 1. `nuxt.options._nitroMajor`, stamped by the host before any module runs.
|
|
368
|
+
* 2. `nuxt._nitro.meta.majorVersion` from the initialized nitro instance.
|
|
369
|
+
* 3. Resolving the `nitro` / `nitropack` package from the project, which is correct on
|
|
370
|
+
* older hosts where the package is a direct dependency.
|
|
371
|
+
*
|
|
372
|
+
* Returns `undefined` when no nitro version can be determined; it never throws.
|
|
373
|
+
*/
|
|
374
|
+
export declare function getNitroVersion(nuxt?: Nuxt): number | undefined;
|
|
279
375
|
/**
|
|
280
376
|
* Get nuxt version
|
|
281
377
|
*/
|
|
282
|
-
declare function getNuxtVersion(nuxt?: Nuxt | any): string;
|
|
378
|
+
export declare function getNuxtVersion(nuxt?: Nuxt | any): string;
|
|
283
379
|
//#endregion
|
|
284
380
|
//#region src/components.d.ts
|
|
285
381
|
/**
|
|
286
382
|
* Register a directory to be scanned for components and imported only when used.
|
|
287
383
|
*/
|
|
288
|
-
declare function addComponentsDir(dir: ComponentsDir, opts?: {
|
|
384
|
+
export declare function addComponentsDir(dir: ComponentsDir, opts?: {
|
|
289
385
|
prepend?: boolean;
|
|
290
386
|
}): void;
|
|
291
387
|
type AddComponentOptions = {
|
|
@@ -295,22 +391,40 @@ type AddComponentOptions = {
|
|
|
295
391
|
/**
|
|
296
392
|
* This utility takes a file path or npm package that is scanned for named exports, which are get added automatically
|
|
297
393
|
*/
|
|
298
|
-
declare function addComponentExports(opts: Omit<AddComponentOptions, 'name'> & {
|
|
394
|
+
export declare function addComponentExports(opts: Omit<AddComponentOptions, 'name'> & {
|
|
299
395
|
prefix?: string;
|
|
300
396
|
}): void;
|
|
301
397
|
/**
|
|
302
398
|
* Register a component by its name and filePath.
|
|
303
399
|
*/
|
|
304
|
-
declare function addComponent(opts: AddComponentOptions): void;
|
|
400
|
+
export declare function addComponent(opts: AddComponentOptions): void;
|
|
305
401
|
//#endregion
|
|
306
402
|
//#region src/context.d.ts
|
|
307
403
|
/**
|
|
308
|
-
*
|
|
404
|
+
* A handle to the global Nuxt instance context.
|
|
309
405
|
* @deprecated Use `getNuxtCtx` instead
|
|
310
406
|
*/
|
|
311
|
-
|
|
407
|
+
interface NuxtContext {
|
|
408
|
+
/** Get the current Nuxt instance. Throws if none is set. */
|
|
409
|
+
use: () => Nuxt;
|
|
410
|
+
/** Get the current Nuxt instance, or `null` when none is set. */
|
|
411
|
+
tryUse: () => Nuxt | null;
|
|
412
|
+
/** Set the current Nuxt instance. */
|
|
413
|
+
set: (instance?: Nuxt, replace?: boolean) => void;
|
|
414
|
+
/** Clear the current Nuxt instance. */
|
|
415
|
+
unset: () => void;
|
|
416
|
+
/** Run a synchronous function with the provided Nuxt instance set. */
|
|
417
|
+
call: <R>(instance: Nuxt, callback: () => R) => R;
|
|
418
|
+
/** Run an asynchronous function with the provided Nuxt instance set. */
|
|
419
|
+
callAsync: <R>(instance: Nuxt, callback: () => R | Promise<R>) => Promise<R>;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Direct access to the Nuxt global context.
|
|
423
|
+
* @deprecated Use `getNuxtCtx` instead
|
|
424
|
+
*/
|
|
425
|
+
export declare const nuxtCtx: NuxtContext;
|
|
312
426
|
/** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
|
|
313
|
-
declare const getNuxtCtx: () => Nuxt | null;
|
|
427
|
+
export declare const getNuxtCtx: () => Nuxt | null;
|
|
314
428
|
/**
|
|
315
429
|
* Get access to Nuxt instance.
|
|
316
430
|
*
|
|
@@ -320,7 +434,7 @@ declare const getNuxtCtx: () => Nuxt | null;
|
|
|
320
434
|
* const nuxt = useNuxt()
|
|
321
435
|
* ```
|
|
322
436
|
*/
|
|
323
|
-
declare function useNuxt(): Nuxt;
|
|
437
|
+
export declare function useNuxt(): Nuxt;
|
|
324
438
|
/**
|
|
325
439
|
* Get access to Nuxt instance.
|
|
326
440
|
*
|
|
@@ -333,22 +447,82 @@ declare function useNuxt(): Nuxt;
|
|
|
333
447
|
* }
|
|
334
448
|
* ```
|
|
335
449
|
*/
|
|
336
|
-
declare function tryUseNuxt(): Nuxt | null;
|
|
337
|
-
declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
|
|
450
|
+
export declare function tryUseNuxt(): Nuxt | null;
|
|
451
|
+
export declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
|
|
338
452
|
//#endregion
|
|
339
453
|
//#region src/ignore.d.ts
|
|
340
|
-
declare function createIsIgnored(nuxt?: Nuxt | null | undefined): (pathname: string, stats?: unknown) => boolean;
|
|
454
|
+
export declare function createIsIgnored(nuxt?: Nuxt | null | undefined): (pathname: string, stats?: unknown) => boolean;
|
|
341
455
|
/**
|
|
342
456
|
* Return a filter function to filter an array of paths
|
|
343
457
|
*/
|
|
344
|
-
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: Nuxt | null | undefined): boolean;
|
|
345
|
-
declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
458
|
+
export declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: Nuxt | null | undefined): boolean;
|
|
459
|
+
export declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
346
460
|
//#endregion
|
|
347
461
|
//#region src/layout.d.ts
|
|
348
|
-
declare function addLayout(template: NuxtTemplate | string, name?: string): void;
|
|
462
|
+
export declare function addLayout(template: NuxtTemplate | string, name?: string): void;
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region src/nitro-types.d.ts
|
|
465
|
+
/**
|
|
466
|
+
* Minimal structural types for the route rules accepted by this package, covering the nitro
|
|
467
|
+
* majors supported by Nuxt.
|
|
468
|
+
*
|
|
469
|
+
* These are inlined (rather than imported from `nitropack`/`nitro`) so that `@nuxt/kit` does not
|
|
470
|
+
* depend on either package being installed. Server registrations are typed by `@nuxt/schema`,
|
|
471
|
+
* which owns them, and normalised by the configured `server.builder`.
|
|
472
|
+
*/
|
|
473
|
+
/**
|
|
474
|
+
* Route rules common to both nitro majors.
|
|
475
|
+
*
|
|
476
|
+
* Route rules are augmentable upstream and these types are inlined, so the index signature is
|
|
477
|
+
* what lets a module set a rule neither nitro declares (`ssr`, `appMiddleware`, its own).
|
|
478
|
+
*/
|
|
479
|
+
interface NitroRouteConfigBase {
|
|
480
|
+
cache?: Record<string, any> | false;
|
|
481
|
+
headers?: Record<string, string>;
|
|
482
|
+
prerender?: boolean;
|
|
483
|
+
isr?: number | boolean | Record<string, any>;
|
|
484
|
+
swr?: boolean | number;
|
|
485
|
+
static?: boolean | number;
|
|
486
|
+
/** Additional route options, including framework-specific route rules. */
|
|
487
|
+
[key: string]: any;
|
|
488
|
+
}
|
|
489
|
+
/** Route rule shape accepted by nitro v2 (`nitropack`). */
|
|
490
|
+
interface NitroRouteConfigV2 extends NitroRouteConfigBase {
|
|
491
|
+
/** A plain string defaults to status `302`. */
|
|
492
|
+
redirect?: string | {
|
|
493
|
+
to: string;
|
|
494
|
+
statusCode?: number;
|
|
495
|
+
};
|
|
496
|
+
proxy?: string | ({
|
|
497
|
+
to: string;
|
|
498
|
+
} & Record<string, any>);
|
|
499
|
+
cors?: boolean;
|
|
500
|
+
}
|
|
501
|
+
/** Route rule shape accepted by nitro v3 (`nitro`). */
|
|
502
|
+
interface NitroRouteConfigV3 extends NitroRouteConfigBase {
|
|
503
|
+
/** A plain string defaults to status `307`. */
|
|
504
|
+
redirect?: string | {
|
|
505
|
+
to: string;
|
|
506
|
+
status?: number;
|
|
507
|
+
} | false;
|
|
508
|
+
/** `false` resets a rule inherited from a less specific pattern. */
|
|
509
|
+
proxy?: string | ({
|
|
510
|
+
to: string;
|
|
511
|
+
} & Record<string, any>) | false;
|
|
512
|
+
cors?: Record<string, any> | boolean;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* A route rule accepted by either supported nitro major.
|
|
516
|
+
*
|
|
517
|
+
* A union rather than one merged shape, so that a rule written as an object literal has to match
|
|
518
|
+
* one major as a whole and excess property checking rejects a literal mixing the two. Anything
|
|
519
|
+
* valid in either is accepted, since the host's nitro major is not visible here; name
|
|
520
|
+
* {@link NitroRouteConfigV2} or {@link NitroRouteConfigV3} to be held to one.
|
|
521
|
+
*/
|
|
522
|
+
type NitroRouteConfig = NitroRouteConfigV2 | NitroRouteConfigV3;
|
|
349
523
|
//#endregion
|
|
350
524
|
//#region src/pages.d.ts
|
|
351
|
-
declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
525
|
+
export declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
352
526
|
interface ExtendRouteRulesOptions {
|
|
353
527
|
/**
|
|
354
528
|
* Override route rule config
|
|
@@ -356,7 +530,7 @@ interface ExtendRouteRulesOptions {
|
|
|
356
530
|
*/
|
|
357
531
|
override?: boolean;
|
|
358
532
|
}
|
|
359
|
-
declare function extendRouteRules(route: string, rule: NitroRouteConfig, options?: ExtendRouteRulesOptions): void;
|
|
533
|
+
export declare function extendRouteRules(route: string, rule: NitroRouteConfig, options?: ExtendRouteRulesOptions): void;
|
|
360
534
|
interface AddRouteMiddlewareOptions {
|
|
361
535
|
/**
|
|
362
536
|
* Override existing middleware with the same name, if it exists
|
|
@@ -369,10 +543,10 @@ interface AddRouteMiddlewareOptions {
|
|
|
369
543
|
*/
|
|
370
544
|
prepend?: boolean;
|
|
371
545
|
}
|
|
372
|
-
declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], options?: AddRouteMiddlewareOptions): void;
|
|
546
|
+
export declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], options?: AddRouteMiddlewareOptions): void;
|
|
373
547
|
//#endregion
|
|
374
548
|
//#region src/plugin.d.ts
|
|
375
|
-
declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
549
|
+
export declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
376
550
|
/**
|
|
377
551
|
* Registers a nuxt plugin and to the plugins array.
|
|
378
552
|
*
|
|
@@ -394,11 +568,11 @@ declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
|
394
568
|
interface AddPluginOptions {
|
|
395
569
|
append?: boolean;
|
|
396
570
|
}
|
|
397
|
-
declare function addPlugin(_plugin: NuxtPlugin | string, opts?: AddPluginOptions): NuxtPlugin;
|
|
571
|
+
export declare function addPlugin(_plugin: NuxtPlugin | string, opts?: AddPluginOptions): NuxtPlugin;
|
|
398
572
|
/**
|
|
399
573
|
* Adds a template and registers as a nuxt plugin.
|
|
400
574
|
*/
|
|
401
|
-
declare function addPluginTemplate(plugin: NuxtPluginTemplate | string, opts?: AddPluginOptions): NuxtPlugin;
|
|
575
|
+
export declare function addPluginTemplate(plugin: NuxtPluginTemplate | string, opts?: AddPluginOptions): NuxtPlugin;
|
|
402
576
|
//#endregion
|
|
403
577
|
//#region src/resolve.d.ts
|
|
404
578
|
interface ResolvePathOptions {
|
|
@@ -435,15 +609,15 @@ interface ResolvePathOptions {
|
|
|
435
609
|
* If a path cannot be resolved, normalized input will be returned unless the `fallbackToOriginal` option is set to `true`,
|
|
436
610
|
* in which case the original input path will be returned.
|
|
437
611
|
*/
|
|
438
|
-
declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
|
|
612
|
+
export declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
|
|
439
613
|
/**
|
|
440
614
|
* Try to resolve first existing file in paths
|
|
441
615
|
*/
|
|
442
|
-
declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: PathType): Promise<string | null>;
|
|
616
|
+
export declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: PathType): Promise<string | null>;
|
|
443
617
|
/**
|
|
444
618
|
* Resolve path aliases respecting Nuxt alias options
|
|
445
619
|
*/
|
|
446
|
-
declare function resolveAlias(path: string, alias?: Record<string, string>): string;
|
|
620
|
+
export declare function resolveAlias(path: string, alias?: Record<string, string>): string;
|
|
447
621
|
interface Resolver {
|
|
448
622
|
resolve(...path: string[]): string;
|
|
449
623
|
resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
|
|
@@ -451,8 +625,8 @@ interface Resolver {
|
|
|
451
625
|
/**
|
|
452
626
|
* Create a relative resolver
|
|
453
627
|
*/
|
|
454
|
-
declare function createResolver(base: string | URL): Resolver;
|
|
455
|
-
declare function resolveNuxtModule(base: string, paths: string[]): Promise<string[]>;
|
|
628
|
+
export declare function createResolver(base: string | URL): Resolver;
|
|
629
|
+
export declare function resolveNuxtModule(base: string, paths: string[]): Promise<string[]>;
|
|
456
630
|
type PathType = 'file' | 'dir';
|
|
457
631
|
/**
|
|
458
632
|
* Resolve absolute file paths in the provided directory with respect to `.nuxtignore` and return them sorted.
|
|
@@ -463,81 +637,29 @@ type PathType = 'file' | 'dir';
|
|
|
463
637
|
* @param opts.ignore additional glob patterns to ignore
|
|
464
638
|
* @returns sorted array of absolute file paths
|
|
465
639
|
*/
|
|
466
|
-
declare function resolveFiles(path: string, pattern: string | string[], opts?: {
|
|
640
|
+
export declare function resolveFiles(path: string, pattern: string | string[], opts?: {
|
|
467
641
|
followSymbolicLinks?: boolean;
|
|
468
|
-
ignore?:
|
|
642
|
+
ignore?: string | readonly string[];
|
|
469
643
|
}): Promise<string[]>;
|
|
470
644
|
//#endregion
|
|
471
|
-
//#region src/nitro.d.ts
|
|
472
|
-
/**
|
|
473
|
-
* Adds a nitro server handler
|
|
474
|
-
*
|
|
475
|
-
*/
|
|
476
|
-
declare function addServerHandler(handler: NitroEventHandler): void;
|
|
477
|
-
/**
|
|
478
|
-
* Adds a nitro server handler for development-only
|
|
479
|
-
*
|
|
480
|
-
*/
|
|
481
|
-
declare function addDevServerHandler(handler: NitroDevEventHandler): void;
|
|
482
|
-
/**
|
|
483
|
-
* Adds a Nitro plugin
|
|
484
|
-
*/
|
|
485
|
-
declare function addServerPlugin(plugin: string): void;
|
|
486
|
-
/**
|
|
487
|
-
* Adds routes to be prerendered
|
|
488
|
-
*/
|
|
489
|
-
declare function addPrerenderRoutes(routes: string | string[]): void;
|
|
490
|
-
/**
|
|
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
|
-
*/
|
|
504
|
-
declare function useNitro(): Nitro;
|
|
505
|
-
/**
|
|
506
|
-
* Add server imports to be auto-imported by Nitro
|
|
507
|
-
*/
|
|
508
|
-
declare function addServerImports(imports: Import | Import[]): void;
|
|
509
|
-
/**
|
|
510
|
-
* Add directories to be scanned for auto-imports by Nitro
|
|
511
|
-
*/
|
|
512
|
-
declare function addServerImportsDir(dirs: string | string[], opts?: {
|
|
513
|
-
prepend?: boolean;
|
|
514
|
-
}): void;
|
|
515
|
-
/**
|
|
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
|
-
*/
|
|
519
|
-
declare function addServerScanDir(dirs: string | string[], opts?: {
|
|
520
|
-
prepend?: boolean;
|
|
521
|
-
}): void;
|
|
522
|
-
//#endregion
|
|
523
645
|
//#region src/template.d.ts
|
|
524
646
|
/**
|
|
525
647
|
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
|
|
526
648
|
*/
|
|
527
|
-
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
649
|
+
export declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
528
650
|
/**
|
|
529
|
-
* Adds a virtual file that can be used within the
|
|
651
|
+
* Adds a virtual file that can be used within the server build.
|
|
530
652
|
*/
|
|
531
|
-
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
|
|
653
|
+
export declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
|
|
532
654
|
/**
|
|
533
|
-
* Renders given types during build to disk in the project `
|
|
655
|
+
* Renders given types during build to disk in the project `typesDir`
|
|
534
656
|
* and register them as types.
|
|
535
657
|
*
|
|
536
658
|
* You can pass a second context object to specify in which context the type should be added.
|
|
537
659
|
*
|
|
538
660
|
* If no context object is passed, then it will only be added to the nuxt context.
|
|
539
661
|
*/
|
|
540
|
-
declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>, context?: {
|
|
662
|
+
export declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>, context?: {
|
|
541
663
|
nitro?: boolean;
|
|
542
664
|
nuxt?: boolean;
|
|
543
665
|
node?: boolean;
|
|
@@ -546,16 +668,21 @@ declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>, context?: {
|
|
|
546
668
|
/**
|
|
547
669
|
* Normalize a nuxt template object
|
|
548
670
|
*/
|
|
549
|
-
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildDir?: string): ResolvedNuxtTemplate<T>;
|
|
671
|
+
export declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildDir?: string): ResolvedNuxtTemplate<T>;
|
|
550
672
|
/**
|
|
551
673
|
* Trigger rebuilding Nuxt templates
|
|
552
674
|
*
|
|
553
675
|
* You can pass a filter within the options to selectively regenerate a subset of templates.
|
|
554
676
|
*/
|
|
555
|
-
declare function updateTemplates(options?: {
|
|
677
|
+
export declare function updateTemplates(options?: {
|
|
556
678
|
filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
|
|
557
679
|
}): Promise<void>;
|
|
558
|
-
|
|
680
|
+
/**
|
|
681
|
+
* Writes the generated `tsconfig` and declaration files to `typesDir`.
|
|
682
|
+
*
|
|
683
|
+
* When a production build uses a `buildDir` other than `typesDir`, existing files are left untouched.
|
|
684
|
+
*/
|
|
685
|
+
export declare function writeTypes(nuxt: Nuxt): Promise<void>;
|
|
559
686
|
//#endregion
|
|
560
687
|
//#region src/types.d.ts
|
|
561
688
|
/**
|
|
@@ -566,9 +693,18 @@ declare function writeTypes(nuxt: Nuxt): Promise<void>;
|
|
|
566
693
|
* A `.mjs` / `.cjs` / `.mts` / `.cts` runtime path is rewritten to an adjacent declaration
|
|
567
694
|
* sibling when one exists; otherwise it is returned as-is for the caller to handle.
|
|
568
695
|
*/
|
|
569
|
-
declare function resolveDeclarationPath(absolutePath: string): Promise<string>;
|
|
696
|
+
export declare function resolveDeclarationPath(absolutePath: string): Promise<string>;
|
|
570
697
|
/** Extract the package name (including scope) from a (possibly subpath) module specifier. */
|
|
571
|
-
declare function packageName(specifier: string): string;
|
|
698
|
+
export declare function packageName(specifier: string): string;
|
|
699
|
+
interface ResolveTypePathsOptions {
|
|
700
|
+
/**
|
|
701
|
+
* Resolve a bare package to the file its entry resolves to, rather than to the package root.
|
|
702
|
+
*
|
|
703
|
+
* A `paths` substitution naming a directory is only followed under `bundler` resolution.
|
|
704
|
+
* `nodenext`, which the `node` environment's tsconfig uses, requires it to name a file.
|
|
705
|
+
*/
|
|
706
|
+
entry?: boolean;
|
|
707
|
+
}
|
|
572
708
|
/**
|
|
573
709
|
* Resolve auto-import / `tsConfig.paths` entries to the path TypeScript should load types from.
|
|
574
710
|
*
|
|
@@ -579,765 +715,273 @@ declare function packageName(specifier: string): string;
|
|
|
579
715
|
*
|
|
580
716
|
* Returns `[specifier, absolutePath]` pairs, omitting any specifier that cannot be resolved.
|
|
581
717
|
*/
|
|
582
|
-
declare function resolveTypePaths(packages: string[], searchPaths: string[]): Promise<Array<[string, string]>>;
|
|
718
|
+
export declare function resolveTypePaths(packages: string[], searchPaths: string[], options?: ResolveTypePathsOptions): Promise<Array<[string, string]>>;
|
|
583
719
|
//#endregion
|
|
584
|
-
//#region src/
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
720
|
+
//#region src/watch.d.ts
|
|
721
|
+
/**
|
|
722
|
+
* The subset of a chokidar `FSWatcher` this helper needs. Callers hold
|
|
723
|
+
* different chokidar majors (Nuxt core watches with v5, Vite bundles v3), so
|
|
724
|
+
* the parameter is structural rather than an import of either package.
|
|
725
|
+
*/
|
|
726
|
+
interface RecoverableWatcher {
|
|
727
|
+
on: (event: any, listener: (...args: any[]) => void) => any;
|
|
728
|
+
emit: (event: any, ...args: any[]) => any;
|
|
729
|
+
options?: {
|
|
730
|
+
cwd?: string | undefined;
|
|
731
|
+
} | undefined;
|
|
732
|
+
}
|
|
589
733
|
/**
|
|
590
|
-
*
|
|
591
|
-
*
|
|
734
|
+
* chokidar suppresses a `change` event that lands within 50ms of the previous
|
|
735
|
+
* `change` for the same path, and never replays it. A save that follows a fast
|
|
736
|
+
* HMR round trip is therefore silently lost until the file is touched again,
|
|
737
|
+
* which looks exactly like broken HMR. This is true of every chokidar major
|
|
738
|
+
* Nuxt uses.
|
|
592
739
|
*
|
|
593
|
-
*
|
|
594
|
-
|
|
595
|
-
|
|
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).
|
|
740
|
+
* Raw fs events are not throttled, so once chokidar has reported a file at
|
|
741
|
+
* least once we can use them to notice a modification that never surfaced as a
|
|
742
|
+
* `change` event, and re-emit it after the throttle window has passed.
|
|
744
743
|
*
|
|
745
|
-
* @
|
|
744
|
+
* @param watcher the chokidar watcher to patch
|
|
745
|
+
* @returns a disposer releasing the recovery state; call it when the watcher closes
|
|
746
746
|
*/
|
|
747
|
-
declare
|
|
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
|
-
}>]>;
|
|
747
|
+
export declare function recoverThrottledChanges(watcher: RecoverableWatcher): () => void;
|
|
835
748
|
//#endregion
|
|
836
|
-
//#region src/
|
|
837
|
-
/**
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
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;
|
|
749
|
+
//#region src/logger.d.ts
|
|
750
|
+
/** Numeric verbosity threshold: `0` (fatal/error) through `5` (trace). */
|
|
751
|
+
type NuxtLogLevel = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});
|
|
752
|
+
/** The kind of message being logged, which determines how it is rendered. */
|
|
753
|
+
type NuxtLogType = 'silent' | 'fatal' | 'error' | 'warn' | 'log' | 'info' | 'success' | 'fail' | 'ready' | 'start' | 'box' | 'debug' | 'trace' | 'verbose';
|
|
754
|
+
/** A structured message, usable in place of a string when logging. */
|
|
755
|
+
interface NuxtLogInput {
|
|
756
|
+
level?: NuxtLogLevel;
|
|
757
|
+
tag?: string;
|
|
758
|
+
type?: NuxtLogType;
|
|
759
|
+
message?: string;
|
|
760
|
+
additional?: string | string[];
|
|
761
|
+
args?: unknown[];
|
|
762
|
+
date?: Date;
|
|
763
|
+
}
|
|
764
|
+
/** A fully resolved log record, as passed to reporters. */
|
|
765
|
+
interface NuxtLogObject extends NuxtLogInput {
|
|
766
|
+
level: NuxtLogLevel;
|
|
767
|
+
type: NuxtLogType;
|
|
768
|
+
tag: string;
|
|
769
|
+
args: unknown[];
|
|
770
|
+
date: Date;
|
|
771
|
+
[key: string]: unknown;
|
|
772
|
+
}
|
|
773
|
+
interface NuxtLogReporter {
|
|
774
|
+
/** Declared with method syntax so implementations may narrow the context type. */
|
|
775
|
+
log(logObject: NuxtLogObject, ctx: {
|
|
776
|
+
options: NuxtLoggerOptions;
|
|
777
|
+
}): void;
|
|
778
|
+
}
|
|
779
|
+
interface NuxtLogFn {
|
|
780
|
+
(message: NuxtLogInput | unknown, ...args: unknown[]): void;
|
|
781
|
+
/** Log the arguments verbatim, bypassing formatting. */
|
|
782
|
+
raw: (...args: unknown[]) => void;
|
|
783
|
+
}
|
|
784
|
+
interface NuxtLoggerOptions {
|
|
785
|
+
level?: NuxtLogLevel;
|
|
786
|
+
reporters?: NuxtLogReporter[];
|
|
787
|
+
/** Default log fields applied to every message. */
|
|
788
|
+
defaults?: NuxtLogInput;
|
|
789
|
+
/** Per-type defaults, keyed by log type. */
|
|
790
|
+
types?: Record<NuxtLogType, NuxtLogInput>;
|
|
791
|
+
/** How many times an identical message may repeat before it is throttled. */
|
|
792
|
+
throttle?: number;
|
|
793
|
+
/** How long, in milliseconds, a throttled message is suppressed for. */
|
|
794
|
+
throttleMin?: number;
|
|
795
|
+
stdout?: NodeJS.WriteStream;
|
|
796
|
+
stderr?: NodeJS.WriteStream;
|
|
797
|
+
/** Replace each log method, for tests. */
|
|
798
|
+
mockFn?: (type: NuxtLogType, defaults: NuxtLogInput) => (...args: any[]) => void;
|
|
799
|
+
/** Replace the prompt implementation. */
|
|
800
|
+
prompt?: (message: string, options?: any) => Promise<any>;
|
|
801
|
+
formatOptions?: {
|
|
802
|
+
columns?: number;
|
|
803
|
+
date?: boolean;
|
|
804
|
+
colors?: boolean;
|
|
805
|
+
compact?: boolean | number;
|
|
806
|
+
errorLevel?: number;
|
|
807
|
+
[key: string]: unknown;
|
|
948
808
|
};
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
|
|
809
|
+
}
|
|
810
|
+
interface NuxtPromptCommonOptions {
|
|
811
|
+
name?: string;
|
|
812
|
+
/** How a cancelled prompt (for example, Ctrl+C) resolves. */
|
|
813
|
+
cancel?: 'default' | 'undefined' | 'null' | 'symbol' | 'reject';
|
|
814
|
+
}
|
|
815
|
+
type NuxtTextPromptOptions = NuxtPromptCommonOptions & {
|
|
816
|
+
type?: 'text';
|
|
817
|
+
default?: string;
|
|
818
|
+
placeholder?: string;
|
|
819
|
+
initial?: string;
|
|
820
|
+
};
|
|
821
|
+
type NuxtConfirmPromptOptions = NuxtPromptCommonOptions & {
|
|
822
|
+
type: 'confirm';
|
|
823
|
+
initial?: boolean;
|
|
824
|
+
};
|
|
825
|
+
type NuxtSelectPromptOptions = NuxtPromptCommonOptions & {
|
|
826
|
+
type: 'select';
|
|
827
|
+
initial?: string;
|
|
828
|
+
options: (string | {
|
|
829
|
+
label: string;
|
|
830
|
+
value?: string;
|
|
831
|
+
hint?: string;
|
|
832
|
+
})[];
|
|
833
|
+
};
|
|
834
|
+
type NuxtMultiSelectPromptOptions = NuxtPromptCommonOptions & {
|
|
835
|
+
type: 'multiselect';
|
|
836
|
+
initial?: string[];
|
|
837
|
+
options: (string | {
|
|
838
|
+
label: string;
|
|
839
|
+
value?: string;
|
|
840
|
+
hint?: string;
|
|
841
|
+
})[];
|
|
842
|
+
required?: boolean;
|
|
843
|
+
};
|
|
844
|
+
type NuxtPromptOptions = NuxtTextPromptOptions | NuxtConfirmPromptOptions | NuxtSelectPromptOptions | NuxtMultiSelectPromptOptions;
|
|
845
|
+
/**
|
|
846
|
+
* The logger interface exposed by Nuxt. Structurally satisfied by `consola`,
|
|
847
|
+
* but Nuxt only guarantees the members declared here.
|
|
848
|
+
*/
|
|
849
|
+
interface NuxtLogger extends Record<NuxtLogType, NuxtLogFn> {
|
|
850
|
+
/** Current verbosity threshold. Assignable to change what is emitted. */
|
|
851
|
+
level: NuxtLogLevel;
|
|
852
|
+
/** The options this logger was created with. */
|
|
853
|
+
options: NuxtLoggerOptions;
|
|
854
|
+
/** Create a derived logger with the given options. */
|
|
855
|
+
create: (options: NuxtLoggerOptions) => NuxtLogger;
|
|
856
|
+
/** Create a derived logger that prefixes every message with `tag`. */
|
|
857
|
+
withTag: (tag: string) => NuxtLogger;
|
|
858
|
+
/** Create a derived logger with default log fields applied. */
|
|
859
|
+
withDefaults: (defaults: NuxtLogInput) => NuxtLogger;
|
|
860
|
+
addReporter: (reporter: NuxtLogReporter) => unknown;
|
|
861
|
+
removeReporter: (reporter: NuxtLogReporter) => unknown;
|
|
862
|
+
setReporters: (reporters: NuxtLogReporter[]) => unknown;
|
|
863
|
+
/** Route `console.*` calls through this logger. */
|
|
864
|
+
wrapConsole: () => void;
|
|
865
|
+
/** Undo `wrapConsole`. */
|
|
866
|
+
restoreConsole: () => void;
|
|
867
|
+
/** Route `console.*`, `process.stdout` and `process.stderr` through this logger. */
|
|
868
|
+
wrapAll: () => void;
|
|
869
|
+
/** Undo `wrapAll`. */
|
|
870
|
+
restoreAll: () => void;
|
|
871
|
+
/** Route `process.stdout` and `process.stderr` through this logger. */
|
|
872
|
+
wrapStd: () => void;
|
|
873
|
+
/** Undo `wrapStd`. */
|
|
874
|
+
restoreStd: () => void;
|
|
875
|
+
/** Buffer log output until `resumeLogs` is called. */
|
|
876
|
+
pauseLogs: () => void;
|
|
877
|
+
resumeLogs: () => void;
|
|
878
|
+
/** Replace every log method, for tests. */
|
|
879
|
+
mockTypes: (mockFn?: NuxtLoggerOptions['mockFn']) => void;
|
|
880
|
+
/**
|
|
881
|
+
* Prompt the user for input. The resolved value depends on `options.type`
|
|
882
|
+
* (`text` -> `string`, `confirm` -> `boolean`, `select` -> the chosen option,
|
|
883
|
+
* `multiselect` -> an array of chosen options), and on `options.cancel` when
|
|
884
|
+
* the prompt is dismissed.
|
|
885
|
+
*
|
|
886
|
+
* Declared with method syntax so implementations may narrow the options type.
|
|
887
|
+
*/
|
|
888
|
+
prompt(message: string, options?: NuxtPromptOptions): Promise<any>;
|
|
889
|
+
}
|
|
890
|
+
export declare const logger: NuxtLogger;
|
|
891
|
+
export declare function useLogger(tag?: string, options?: NuxtLoggerOptions): NuxtLogger;
|
|
952
892
|
//#endregion
|
|
953
|
-
//#region src/
|
|
893
|
+
//#region src/terminal.d.ts
|
|
894
|
+
/** A unit of long-running work, rendered on the host's status surface where available. */
|
|
895
|
+
interface NuxtTerminalTask {
|
|
896
|
+
/** Change the label of the running task. */
|
|
897
|
+
update: (label: string) => void;
|
|
898
|
+
/** Finish the task, optionally with a closing message. Defaults to a successful outcome. */
|
|
899
|
+
stop: (message?: string, outcome?: 'success' | 'failure') => void;
|
|
900
|
+
}
|
|
901
|
+
interface NuxtTerminalNotification {
|
|
902
|
+
title?: string;
|
|
903
|
+
message: string;
|
|
904
|
+
level?: 'info' | 'warn';
|
|
905
|
+
}
|
|
906
|
+
interface NuxtTerminalNotice {
|
|
907
|
+
/** Retract the notice. */
|
|
908
|
+
dismiss: () => void;
|
|
909
|
+
/** Settles once the notice is gone: acknowledged by the user or retracted. */
|
|
910
|
+
dismissed: Promise<void>;
|
|
911
|
+
}
|
|
912
|
+
interface NuxtTerminal {
|
|
913
|
+
/**
|
|
914
|
+
* Whether an interactive host (such as the `nuxt dev` TUI) is present. `false` means the
|
|
915
|
+
* primitives below fall back to plain logging on the current process streams.
|
|
916
|
+
*/
|
|
917
|
+
readonly interactive: boolean;
|
|
918
|
+
/**
|
|
919
|
+
* Borrow the terminal for the duration of `work`: any host UI is suspended and stdin is
|
|
920
|
+
* released, so `work` may read from stdin and write directly to the terminal.
|
|
921
|
+
*
|
|
922
|
+
* Concurrent callers are serialised by the host; a nested call from within a borrow runs
|
|
923
|
+
* immediately.
|
|
924
|
+
*/
|
|
925
|
+
withTerminal: <T>(work: () => Promise<T>) => Promise<T>;
|
|
926
|
+
/** Ask the user a question, taking over the terminal for as long as the prompt is open. */
|
|
927
|
+
prompt: (message: string, options?: NuxtPromptOptions) => Promise<any>;
|
|
928
|
+
/** Start a task, to be finished with `task.stop()`. */
|
|
929
|
+
startTask: (label: string) => NuxtTerminalTask;
|
|
930
|
+
/** Show a message and hold it on screen until it is acknowledged or retracted. */
|
|
931
|
+
notify: (notification: NuxtTerminalNotification) => NuxtTerminalNotice;
|
|
932
|
+
}
|
|
954
933
|
/**
|
|
955
|
-
*
|
|
956
|
-
*
|
|
934
|
+
* Access the terminal, cooperating with the host UI (such as the `nuxt dev` TUI) when one is
|
|
935
|
+
* running, and falling back to logging when it is not.
|
|
957
936
|
*
|
|
958
|
-
*
|
|
937
|
+
* Use this instead of writing to `process.stdout` or prompting directly, so that prompts are
|
|
938
|
+
* answerable, tasks are rendered in one place, and nothing is lost to a captured stream.
|
|
959
939
|
*/
|
|
960
|
-
declare
|
|
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
|
-
}>]>;
|
|
940
|
+
export declare function useTerminal(): NuxtTerminal;
|
|
1081
941
|
//#endregion
|
|
1082
|
-
//#region src/
|
|
942
|
+
//#region src/dependency.d.ts
|
|
943
|
+
interface EnsureDependencyInstalledOptions {
|
|
944
|
+
rootDir?: string;
|
|
945
|
+
searchPaths?: string[];
|
|
946
|
+
/**
|
|
947
|
+
* Additional URL or path to resolve packages from (e.g. `import.meta.url`).
|
|
948
|
+
* Useful when the calling package ships optional deps as peer dependencies.
|
|
949
|
+
*/
|
|
950
|
+
from?: string;
|
|
951
|
+
/**
|
|
952
|
+
* Whether to prompt the user to install the dependency.
|
|
953
|
+
*
|
|
954
|
+
* - `true`: always prompt
|
|
955
|
+
* - `false`: never prompt (install automatically on StackBlitz)
|
|
956
|
+
* - `undefined`: prompt unless on StackBlitz
|
|
957
|
+
*/
|
|
958
|
+
prompt?: boolean;
|
|
959
|
+
}
|
|
1083
960
|
/**
|
|
1084
|
-
*
|
|
1085
|
-
* Configuration diagnostics.
|
|
961
|
+
* Ensure one or more dependencies are installed, prompting the user to install any that are missing.
|
|
1086
962
|
*
|
|
1087
|
-
*
|
|
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.
|
|
963
|
+
* When called with a single package name (string), returns `true` if available, `false` if not.
|
|
1167
964
|
*
|
|
1168
|
-
*
|
|
965
|
+
* When called with an array, returns `true` if all are available, or an array of
|
|
966
|
+
* package names that are still missing (user declined, install failed, or CI).
|
|
967
|
+
*
|
|
968
|
+
* @param names - One or more package names to check and potentially install
|
|
969
|
+
* @param options - Configuration options
|
|
1169
970
|
*/
|
|
1170
|
-
declare
|
|
1171
|
-
|
|
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
|
|
971
|
+
export declare function ensureDependencyInstalled(names: string, options?: EnsureDependencyInstalledOptions): Promise<boolean>;
|
|
972
|
+
export declare function ensureDependencyInstalled(names: string[], options?: EnsureDependencyInstalledOptions): Promise<true | string[]>;
|
|
1212
973
|
/**
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
974
|
+
* Get the command a user should run to add dependencies to their project, using the
|
|
975
|
+
* package manager detected from `cwd` (falling back to `npm`).
|
|
1215
976
|
*
|
|
1216
|
-
* @
|
|
977
|
+
* @param names - One or more package names to install
|
|
978
|
+
* @param cwd - Directory to detect the package manager from
|
|
979
|
+
* @param options - Options for the install command
|
|
980
|
+
* @param options.dev - Whether the command should install as a dev dependency
|
|
1217
981
|
*/
|
|
1218
|
-
declare
|
|
1219
|
-
|
|
1220
|
-
|
|
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
|
-
}>]>;
|
|
982
|
+
export declare function getAddDependencyCommand(names: string | string[], cwd: string, options?: {
|
|
983
|
+
dev?: boolean;
|
|
984
|
+
}): Promise<string>;
|
|
1341
985
|
//#endregion
|
|
1342
986
|
//#region src/internal/esm.d.ts
|
|
1343
987
|
interface ResolveModuleOptions {
|
|
@@ -1347,30 +991,34 @@ interface ResolveModuleOptions {
|
|
|
1347
991
|
/** @default ['.mjs', '.js', '.cjs', '.mts', '.ts', '.cts', '.tsx', '.jsx'] */
|
|
1348
992
|
extensions?: string[];
|
|
1349
993
|
}
|
|
1350
|
-
declare function directoryToURL(dir: string): URL;
|
|
994
|
+
export declare function directoryToURL(dir: string): URL;
|
|
1351
995
|
/**
|
|
1352
996
|
* Resolve a module from a given root path using an algorithm patterned on
|
|
1353
997
|
* the upcoming `import.meta.resolve`. It returns a file URL
|
|
1354
|
-
*
|
|
1355
|
-
* @internal
|
|
1356
998
|
*/
|
|
1357
|
-
declare function tryResolveModule(id: string, url: URL | URL[]): Promise<string | undefined>;
|
|
999
|
+
export declare function tryResolveModule(id: string, url: URL | URL[]): Promise<string | undefined>;
|
|
1358
1000
|
/** @deprecated pass URLs pointing at files */
|
|
1359
|
-
declare function tryResolveModule(id: string, url: string | string[]): Promise<string | undefined>;
|
|
1360
|
-
declare function resolveModule(id: string, options?: ResolveModuleOptions): string;
|
|
1001
|
+
export declare function tryResolveModule(id: string, url: string | string[]): Promise<string | undefined>;
|
|
1002
|
+
export declare function resolveModule(id: string, options?: ResolveModuleOptions): string;
|
|
1361
1003
|
interface ImportModuleOptions extends ResolveModuleOptions {
|
|
1362
1004
|
/** Automatically de-default the result of requiring the module. */
|
|
1363
1005
|
interopDefault?: boolean;
|
|
1364
1006
|
}
|
|
1365
|
-
declare function importModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T>;
|
|
1366
|
-
declare function tryImportModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T | undefined> | undefined;
|
|
1007
|
+
export declare function importModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T>;
|
|
1008
|
+
export declare function tryImportModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T | undefined> | undefined;
|
|
1367
1009
|
/**
|
|
1368
1010
|
* @deprecated Please use `importModule` instead.
|
|
1369
1011
|
*/
|
|
1370
|
-
declare function requireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T;
|
|
1012
|
+
export declare function requireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T;
|
|
1371
1013
|
/**
|
|
1372
1014
|
* @deprecated Please use `tryImportModule` instead.
|
|
1373
1015
|
*/
|
|
1374
|
-
declare function tryRequireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T | undefined;
|
|
1016
|
+
export declare function tryRequireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T | undefined;
|
|
1017
|
+
//#endregion
|
|
1018
|
+
//#region src/index.d.ts
|
|
1019
|
+
/** @deprecated Internal. Import from `@nuxt/kit/internal` instead. */
|
|
1020
|
+
export declare const DEFAULT_JS_FILE_EXTENSIONS: string[];
|
|
1021
|
+
/** @deprecated Internal. Import from `@nuxt/kit/internal` instead. */
|
|
1022
|
+
export declare const DEFAULT_JSX_FILE_EXTENSIONS: string[];
|
|
1375
1023
|
//#endregion
|
|
1376
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions,
|
|
1024
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type EnsureDependencyInstalledOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LayerDirectories, type LoadNuxtConfigOptions, type LoadNuxtOptions, type NitroInstance, type NitroInstanceOptions, type NitroRouteConfig, type NitroRouteConfigV2, type NitroRouteConfigV3, type NuxtConfigDiffEntry, type NuxtContext, type NuxtLogFn, type NuxtLogInput, type NuxtLogLevel, type NuxtLogObject, type NuxtLogReporter, type NuxtLogType, type NuxtLogger, type NuxtLoggerOptions, type NuxtMajorVersion, type NuxtPromptOptions, type NuxtTerminal, type NuxtTerminalNotice, type NuxtTerminalNotification, type NuxtTerminalTask, type RecoverableWatcher, type ResolveModuleOptions, type ResolvePathOptions, type ResolveTypePathsOptions, type ResolvedNuxtConfigContext, type Resolver, type ServerImportInput, addDevServerHandler, addNitroPlugin, addPrerenderRoutes, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, getDirectory, installModule, loadNuxtModuleInstance, normalizeModuleTranspilePath, resolveModuleWithOptions, resolveServerVariant, tryUseNitro, useNitro };
|