@depup/nuxt__kit 4.4.2-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/LICENSE +21 -0
- package/README.md +31 -0
- package/changes.json +10 -0
- package/dist/index.d.mts +584 -0
- package/dist/index.mjs +1981 -0
- package/package.json +84 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016-present - Nuxt Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @depup/nuxt__kit
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [@nuxt/kit](https://www.npmjs.com/package/@nuxt/kit)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/nuxt__kit
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [@nuxt/kit](https://www.npmjs.com/package/@nuxt/kit) @ 4.4.2 |
|
|
17
|
+
| Processed | 2026-03-17 |
|
|
18
|
+
| Smoke test | passed |
|
|
19
|
+
| Deps updated | 1 |
|
|
20
|
+
|
|
21
|
+
## Dependency Changes
|
|
22
|
+
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| c12 | ^3.3.3 | ^4.0.0-beta.4 |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@nuxt/kit
|
|
30
|
+
|
|
31
|
+
License inherited from the original package.
|
package/changes.json
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
import { ConsolaInstance, ConsolaOptions } from "consola";
|
|
2
|
+
import { UseContext } from "unctx";
|
|
3
|
+
import { GlobOptions } from "tinyglobby";
|
|
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, InlinePreset } from "unimport";
|
|
7
|
+
import { Configuration, WebpackPluginInstance } from "webpack";
|
|
8
|
+
import { RspackPluginInstance } from "@rspack/core";
|
|
9
|
+
import { Plugin, UserConfig } from "vite";
|
|
10
|
+
import * as NitroV2 from "nitropack/types";
|
|
11
|
+
import * as NitroV3 from "nitro/types";
|
|
12
|
+
|
|
13
|
+
//#region src/module/define.d.ts
|
|
14
|
+
/**
|
|
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
|
+
*/
|
|
18
|
+
declare function defineNuxtModule<TOptions extends ModuleOptions>(definition: ModuleDefinition<TOptions, Partial<TOptions>, false> | NuxtModule<TOptions, Partial<TOptions>, false>): NuxtModule<TOptions, TOptions, false>;
|
|
19
|
+
declare function defineNuxtModule<TOptions extends ModuleOptions>(): {
|
|
20
|
+
with: <TOptionsDefaults extends Partial<TOptions>>(definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | NuxtModule<TOptions, TOptionsDefaults, true>) => NuxtModule<TOptions, TOptionsDefaults, true>;
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/module/install.d.ts
|
|
24
|
+
type ModuleToInstall = string | NuxtModule<ModuleOptions, Partial<ModuleOptions>, false>;
|
|
25
|
+
/**
|
|
26
|
+
* Installs a set of modules on a Nuxt instance.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
declare function installModules(modulesToInstall: Map<ModuleToInstall, Record<string, any>>, resolvedModulePaths: Set<string>, nuxt?: Nuxt): Promise<void>;
|
|
30
|
+
/**
|
|
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["modules"]>[number], [T, any]>>(moduleToInstall: T, inlineOptions?: [Config] extends [never] ? any : Config[1], nuxt?: Nuxt): Promise<void>;
|
|
35
|
+
declare function resolveModuleWithOptions(definition: NuxtModule<any> | string | false | undefined | null | [(NuxtModule | string)?, Record<string, any>?], nuxt: Nuxt): {
|
|
36
|
+
resolvedPath?: string;
|
|
37
|
+
module: string | NuxtModule<any>;
|
|
38
|
+
options: Record<string, any>;
|
|
39
|
+
} | undefined;
|
|
40
|
+
declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{
|
|
41
|
+
nuxtModule: NuxtModule<any>;
|
|
42
|
+
buildTimeModuleMeta: ModuleMeta;
|
|
43
|
+
resolvedModulePath?: string;
|
|
44
|
+
}>;
|
|
45
|
+
declare function getDirectory(p: string): string;
|
|
46
|
+
declare const normalizeModuleTranspilePath: (p: string) => string;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/module/compatibility.d.ts
|
|
49
|
+
/**
|
|
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
|
+
*/
|
|
55
|
+
declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if a Nuxt module is compatible with a given semver version.
|
|
58
|
+
*/
|
|
59
|
+
declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
|
|
60
|
+
/**
|
|
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
|
+
*/
|
|
65
|
+
declare function getNuxtModuleVersion(module: string | NuxtModule, nuxt?: Nuxt | any): Promise<string | false>;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/loader/config.d.ts
|
|
68
|
+
interface LoadNuxtConfigOptions extends Omit<LoadConfigOptions<NuxtConfig>, "overrides"> {
|
|
69
|
+
overrides?: Exclude<LoadConfigOptions<NuxtConfig>["overrides"], Promise<any> | Function>;
|
|
70
|
+
}
|
|
71
|
+
declare function loadNuxtConfig(opts: LoadNuxtConfigOptions): Promise<NuxtOptions>;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/loader/schema.d.ts
|
|
74
|
+
declare function extendNuxtSchema(def: SchemaDefinition | (() => SchemaDefinition)): void;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/loader/nuxt.d.ts
|
|
77
|
+
interface LoadNuxtOptions extends LoadNuxtConfigOptions {
|
|
78
|
+
/** Load nuxt with development mode */
|
|
79
|
+
dev?: boolean;
|
|
80
|
+
/** Use lazy initialization of nuxt if set to false */
|
|
81
|
+
ready?: boolean;
|
|
82
|
+
}
|
|
83
|
+
declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
|
|
84
|
+
declare function buildNuxt(nuxt: Nuxt): Promise<any>;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/layers.d.ts
|
|
87
|
+
interface LayerDirectories {
|
|
88
|
+
/** Nuxt rootDir (`/` by default) */
|
|
89
|
+
readonly root: string;
|
|
90
|
+
/** Nitro source directory (`/server` by default) */
|
|
91
|
+
readonly server: string;
|
|
92
|
+
/** Local modules directory (`/modules` by default) */
|
|
93
|
+
readonly modules: string;
|
|
94
|
+
/** Shared directory (`/shared` by default) */
|
|
95
|
+
readonly shared: string;
|
|
96
|
+
/** Public directory (`/public` by default) */
|
|
97
|
+
readonly public: string;
|
|
98
|
+
/** Nuxt srcDir (`/app/` by default) */
|
|
99
|
+
readonly app: string;
|
|
100
|
+
/** Layouts directory (`/app/layouts` by default) */
|
|
101
|
+
readonly appLayouts: string;
|
|
102
|
+
/** Middleware directory (`/app/middleware` by default) */
|
|
103
|
+
readonly appMiddleware: string;
|
|
104
|
+
/** Pages directory (`/app/pages` by default) */
|
|
105
|
+
readonly appPages: string;
|
|
106
|
+
/** Plugins directory (`/app/plugins` by default) */
|
|
107
|
+
readonly appPlugins: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
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
|
+
*/
|
|
120
|
+
declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/head.d.ts
|
|
123
|
+
declare function setGlobalHead(head: NuxtAppConfig["head"]): void;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/imports.d.ts
|
|
126
|
+
declare function addImports(imports: Import | Import[]): void;
|
|
127
|
+
declare function addImportsDir(dirs: string | string[], opts?: {
|
|
128
|
+
prepend?: boolean;
|
|
129
|
+
}): void;
|
|
130
|
+
declare function addImportsSources(presets: InlinePreset | InlinePreset[]): void;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/runtime-config.d.ts
|
|
133
|
+
/**
|
|
134
|
+
* Access 'resolved' Nuxt runtime configuration, with values updated from environment.
|
|
135
|
+
*
|
|
136
|
+
* This mirrors the runtime behavior of Nitro.
|
|
137
|
+
*/
|
|
138
|
+
declare function useRuntimeConfig(): Record<string, any>;
|
|
139
|
+
/**
|
|
140
|
+
* Update Nuxt runtime configuration.
|
|
141
|
+
*/
|
|
142
|
+
declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/build.d.ts
|
|
145
|
+
type Arrayable<T> = T | T[];
|
|
146
|
+
type Thenable<T> = T | Promise<T>;
|
|
147
|
+
interface ExtendConfigOptions {
|
|
148
|
+
/**
|
|
149
|
+
* Install plugin on dev
|
|
150
|
+
* @default true
|
|
151
|
+
*/
|
|
152
|
+
dev?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Install plugin on build
|
|
155
|
+
* @default true
|
|
156
|
+
*/
|
|
157
|
+
build?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Install plugin on server side
|
|
160
|
+
* @default true
|
|
161
|
+
*/
|
|
162
|
+
server?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Install plugin on client side
|
|
165
|
+
* @default true
|
|
166
|
+
*/
|
|
167
|
+
client?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Prepends the plugin to the array with `unshift()` instead of `push()`.
|
|
170
|
+
*/
|
|
171
|
+
prepend?: boolean;
|
|
172
|
+
}
|
|
173
|
+
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {}
|
|
174
|
+
interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, "server" | "client"> {
|
|
175
|
+
/**
|
|
176
|
+
* Extend server Vite configuration
|
|
177
|
+
* @default true
|
|
178
|
+
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
|
|
179
|
+
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
|
|
180
|
+
* You can likely use a Vite plugin to achieve the same result.
|
|
181
|
+
*/
|
|
182
|
+
server?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Extend client Vite configuration
|
|
185
|
+
* @default true
|
|
186
|
+
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
|
|
187
|
+
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
|
|
188
|
+
* You can likely use a Vite plugin to achieve the same result.
|
|
189
|
+
*/
|
|
190
|
+
client?: boolean;
|
|
191
|
+
}
|
|
192
|
+
type ExtendWebpacklikeConfig = (fn: (config: Configuration) => void, options?: ExtendWebpackConfigOptions) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Extend webpack config
|
|
195
|
+
*
|
|
196
|
+
* The fallback function might be called multiple times
|
|
197
|
+
* when applying to both client and server builds.
|
|
198
|
+
*/
|
|
199
|
+
declare const extendWebpackConfig: ExtendWebpacklikeConfig;
|
|
200
|
+
/**
|
|
201
|
+
* Extend rspack config
|
|
202
|
+
*
|
|
203
|
+
* The fallback function might be called multiple times
|
|
204
|
+
* when applying to both client and server builds.
|
|
205
|
+
*/
|
|
206
|
+
declare const extendRspackConfig: ExtendWebpacklikeConfig;
|
|
207
|
+
/**
|
|
208
|
+
* Extend Vite config
|
|
209
|
+
*/
|
|
210
|
+
declare function extendViteConfig(fn: ((config: UserConfig) => Thenable<void>), options?: ExtendViteConfigOptions): (() => void) | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Append webpack plugin to the config.
|
|
213
|
+
*/
|
|
214
|
+
declare function addWebpackPlugin(pluginOrGetter: Arrayable<WebpackPluginInstance> | (() => Thenable<Arrayable<WebpackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
215
|
+
/**
|
|
216
|
+
* Append rspack plugin to the config.
|
|
217
|
+
*/
|
|
218
|
+
declare function addRspackPlugin(pluginOrGetter: Arrayable<RspackPluginInstance> | (() => Thenable<Arrayable<RspackPluginInstance>>), options?: ExtendWebpackConfigOptions): void;
|
|
219
|
+
/**
|
|
220
|
+
* Append Vite plugin to the config.
|
|
221
|
+
*/
|
|
222
|
+
declare function addVitePlugin(pluginOrGetter: Arrayable<Plugin> | (() => Thenable<Arrayable<Plugin>>), options?: ExtendConfigOptions): void;
|
|
223
|
+
interface AddBuildPluginFactory {
|
|
224
|
+
vite?: () => Thenable<Arrayable<Plugin>>;
|
|
225
|
+
webpack?: () => Thenable<Arrayable<WebpackPluginInstance>>;
|
|
226
|
+
rspack?: () => Thenable<Arrayable<RspackPluginInstance>>;
|
|
227
|
+
}
|
|
228
|
+
declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/compatibility.d.ts
|
|
231
|
+
declare function normalizeSemanticVersion(version: string): string;
|
|
232
|
+
/**
|
|
233
|
+
* Check version constraints and return incompatibility issues as an array
|
|
234
|
+
*/
|
|
235
|
+
declare function checkNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<NuxtCompatibilityIssues>;
|
|
236
|
+
/**
|
|
237
|
+
* Check version constraints and throw a detailed error if has any, otherwise returns true
|
|
238
|
+
*/
|
|
239
|
+
declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<true>;
|
|
240
|
+
/**
|
|
241
|
+
* Check version constraints and return true if passed, otherwise returns false
|
|
242
|
+
*/
|
|
243
|
+
declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
|
|
244
|
+
type NuxtMajorVersion = 2 | 3 | 4;
|
|
245
|
+
/**
|
|
246
|
+
* Check if current Nuxt instance is of specified major version
|
|
247
|
+
*/
|
|
248
|
+
declare function isNuxtMajorVersion(majorVersion: NuxtMajorVersion, nuxt?: Nuxt): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* @deprecated Use `isNuxtMajorVersion(2, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
251
|
+
*/
|
|
252
|
+
declare function isNuxt2(nuxt?: Nuxt): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* @deprecated Use `isNuxtMajorVersion(3, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
|
|
255
|
+
*/
|
|
256
|
+
declare function isNuxt3(nuxt?: Nuxt): boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Get nuxt version
|
|
259
|
+
*/
|
|
260
|
+
declare function getNuxtVersion(nuxt?: Nuxt | any): string;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/components.d.ts
|
|
263
|
+
/**
|
|
264
|
+
* Register a directory to be scanned for components and imported only when used.
|
|
265
|
+
*/
|
|
266
|
+
declare function addComponentsDir(dir: ComponentsDir, opts?: {
|
|
267
|
+
prepend?: boolean;
|
|
268
|
+
}): void;
|
|
269
|
+
type AddComponentOptions = {
|
|
270
|
+
name: string;
|
|
271
|
+
filePath: string;
|
|
272
|
+
} & Partial<Exclude<Component, "shortPath" | "async" | "level" | "import" | "asyncImport">>;
|
|
273
|
+
/**
|
|
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, "name"> & {
|
|
277
|
+
prefix?: string;
|
|
278
|
+
}): void;
|
|
279
|
+
/**
|
|
280
|
+
* Register a component by its name and filePath.
|
|
281
|
+
*/
|
|
282
|
+
declare function addComponent(opts: AddComponentOptions): void;
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/context.d.ts
|
|
285
|
+
/**
|
|
286
|
+
* Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
|
|
287
|
+
* @deprecated Use `getNuxtCtx` instead
|
|
288
|
+
*/
|
|
289
|
+
declare const nuxtCtx: UseContext<Nuxt>;
|
|
290
|
+
/** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
|
|
291
|
+
declare const getNuxtCtx: () => Nuxt | null;
|
|
292
|
+
/**
|
|
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
|
+
*/
|
|
301
|
+
declare function useNuxt(): Nuxt;
|
|
302
|
+
/**
|
|
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
|
+
*/
|
|
314
|
+
declare function tryUseNuxt(): Nuxt | null;
|
|
315
|
+
declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/ignore.d.ts
|
|
318
|
+
declare function createIsIgnored(nuxt?: Nuxt | null | undefined): (pathname: string, stats?: unknown) => boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Return a filter function to filter an array of paths
|
|
321
|
+
*/
|
|
322
|
+
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: Nuxt | null | undefined): boolean;
|
|
323
|
+
declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/layout.d.ts
|
|
326
|
+
declare function addLayout(template: NuxtTemplate | string, name?: string): void;
|
|
327
|
+
//#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
|
+
//#region src/pages.d.ts
|
|
337
|
+
declare function extendPages(cb: NuxtHooks["pages:extend"]): void;
|
|
338
|
+
interface ExtendRouteRulesOptions {
|
|
339
|
+
/**
|
|
340
|
+
* Override route rule config
|
|
341
|
+
* @default false
|
|
342
|
+
*/
|
|
343
|
+
override?: boolean;
|
|
344
|
+
}
|
|
345
|
+
declare function extendRouteRules(route: string, rule: NitroRouteConfig, options?: ExtendRouteRulesOptions): void;
|
|
346
|
+
interface AddRouteMiddlewareOptions {
|
|
347
|
+
/**
|
|
348
|
+
* Override existing middleware with the same name, if it exists
|
|
349
|
+
* @default false
|
|
350
|
+
*/
|
|
351
|
+
override?: boolean;
|
|
352
|
+
/**
|
|
353
|
+
* Prepend middleware to the list
|
|
354
|
+
* @default false
|
|
355
|
+
*/
|
|
356
|
+
prepend?: boolean;
|
|
357
|
+
}
|
|
358
|
+
declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], options?: AddRouteMiddlewareOptions): void;
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/plugin.d.ts
|
|
361
|
+
declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
362
|
+
/**
|
|
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
|
+
*/
|
|
380
|
+
interface AddPluginOptions {
|
|
381
|
+
append?: boolean;
|
|
382
|
+
}
|
|
383
|
+
declare function addPlugin(_plugin: NuxtPlugin | string, opts?: AddPluginOptions): NuxtPlugin;
|
|
384
|
+
/**
|
|
385
|
+
* Adds a template and registers as a nuxt plugin.
|
|
386
|
+
*/
|
|
387
|
+
declare function addPluginTemplate(plugin: NuxtPluginTemplate | string, opts?: AddPluginOptions): NuxtPlugin;
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/resolve.d.ts
|
|
390
|
+
interface ResolvePathOptions {
|
|
391
|
+
/** Base for resolving paths from. Default is Nuxt rootDir. */
|
|
392
|
+
cwd?: string;
|
|
393
|
+
/** An object of aliases. Default is Nuxt configured aliases. */
|
|
394
|
+
alias?: Record<string, string>;
|
|
395
|
+
/**
|
|
396
|
+
* The file extensions to try.
|
|
397
|
+
* Default is Nuxt configured extensions.
|
|
398
|
+
*
|
|
399
|
+
* Isn't considered when `type` is set to `'dir'`.
|
|
400
|
+
*/
|
|
401
|
+
extensions?: string[];
|
|
402
|
+
/**
|
|
403
|
+
* Whether to resolve files that exist in the Nuxt VFS (for example, as a Nuxt template).
|
|
404
|
+
* @default false
|
|
405
|
+
*/
|
|
406
|
+
virtual?: boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Whether to fallback to the original path if the resolved path does not exist instead of returning the normalized input path.
|
|
409
|
+
* @default false
|
|
410
|
+
*/
|
|
411
|
+
fallbackToOriginal?: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* The type of the path to be resolved.
|
|
414
|
+
* @default 'file'
|
|
415
|
+
*/
|
|
416
|
+
type?: PathType;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
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
|
+
*/
|
|
424
|
+
declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
|
|
425
|
+
/**
|
|
426
|
+
* Try to resolve first existing file in paths
|
|
427
|
+
*/
|
|
428
|
+
declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: PathType): Promise<string | null>;
|
|
429
|
+
/**
|
|
430
|
+
* Resolve path aliases respecting Nuxt alias options
|
|
431
|
+
*/
|
|
432
|
+
declare function resolveAlias(path: string, alias?: Record<string, string>): string;
|
|
433
|
+
interface Resolver {
|
|
434
|
+
resolve(...path: string[]): string;
|
|
435
|
+
resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Create a relative resolver
|
|
439
|
+
*/
|
|
440
|
+
declare function createResolver(base: string | URL): Resolver;
|
|
441
|
+
declare function resolveNuxtModule(base: string, paths: string[]): Promise<string[]>;
|
|
442
|
+
type PathType = "file" | "dir";
|
|
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
|
+
*/
|
|
452
|
+
declare function resolveFiles(path: string, pattern: string | string[], opts?: {
|
|
453
|
+
followSymbolicLinks?: boolean;
|
|
454
|
+
ignore?: GlobOptions["ignore"];
|
|
455
|
+
}): Promise<string[]>;
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/nitro.d.ts
|
|
458
|
+
/**
|
|
459
|
+
* Adds a nitro server handler
|
|
460
|
+
*
|
|
461
|
+
*/
|
|
462
|
+
declare function addServerHandler(handler: NitroEventHandler): void;
|
|
463
|
+
/**
|
|
464
|
+
* Adds a nitro server handler for development-only
|
|
465
|
+
*
|
|
466
|
+
*/
|
|
467
|
+
declare function addDevServerHandler(handler: NitroDevEventHandler): void;
|
|
468
|
+
/**
|
|
469
|
+
* Adds a Nitro plugin
|
|
470
|
+
*/
|
|
471
|
+
declare function addServerPlugin(plugin: string): void;
|
|
472
|
+
/**
|
|
473
|
+
* Adds routes to be prerendered
|
|
474
|
+
*/
|
|
475
|
+
declare function addPrerenderRoutes(routes: string | string[]): void;
|
|
476
|
+
/**
|
|
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
|
+
*/
|
|
490
|
+
declare function useNitro(): Nitro;
|
|
491
|
+
/**
|
|
492
|
+
* Add server imports to be auto-imported by Nitro
|
|
493
|
+
*/
|
|
494
|
+
declare function addServerImports(imports: Import | Import[]): void;
|
|
495
|
+
/**
|
|
496
|
+
* Add directories to be scanned for auto-imports by Nitro
|
|
497
|
+
*/
|
|
498
|
+
declare function addServerImportsDir(dirs: string | string[], opts?: {
|
|
499
|
+
prepend?: boolean;
|
|
500
|
+
}): void;
|
|
501
|
+
/**
|
|
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
|
+
*/
|
|
505
|
+
declare function addServerScanDir(dirs: string | string[], opts?: {
|
|
506
|
+
prepend?: boolean;
|
|
507
|
+
}): void;
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region src/template.d.ts
|
|
510
|
+
/**
|
|
511
|
+
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
|
|
512
|
+
*/
|
|
513
|
+
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
514
|
+
/**
|
|
515
|
+
* Adds a virtual file that can be used within the Nuxt Nitro server build.
|
|
516
|
+
*/
|
|
517
|
+
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
|
|
518
|
+
/**
|
|
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
|
+
*/
|
|
526
|
+
declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>, context?: {
|
|
527
|
+
nitro?: boolean;
|
|
528
|
+
nuxt?: boolean;
|
|
529
|
+
node?: boolean;
|
|
530
|
+
shared?: boolean;
|
|
531
|
+
}): ResolvedNuxtTemplate<T>;
|
|
532
|
+
/**
|
|
533
|
+
* Normalize a nuxt template object
|
|
534
|
+
*/
|
|
535
|
+
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildDir?: string): ResolvedNuxtTemplate<T>;
|
|
536
|
+
/**
|
|
537
|
+
* Trigger rebuilding Nuxt templates
|
|
538
|
+
*
|
|
539
|
+
* You can pass a filter within the options to selectively regenerate a subset of templates.
|
|
540
|
+
*/
|
|
541
|
+
declare function updateTemplates(options?: {
|
|
542
|
+
filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
|
|
543
|
+
}): Promise<void>;
|
|
544
|
+
declare function writeTypes(nuxt: Nuxt): Promise<void>;
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/logger.d.ts
|
|
547
|
+
declare const logger: ConsolaInstance;
|
|
548
|
+
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/internal/esm.d.ts
|
|
551
|
+
interface ResolveModuleOptions {
|
|
552
|
+
/** @deprecated use `url` with URLs pointing at a file - never a directory */
|
|
553
|
+
paths?: string | string[];
|
|
554
|
+
url?: URL | URL[];
|
|
555
|
+
/** @default ['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts'] */
|
|
556
|
+
extensions?: string[];
|
|
557
|
+
}
|
|
558
|
+
declare function directoryToURL(dir: string): URL;
|
|
559
|
+
/**
|
|
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
|
+
*/
|
|
565
|
+
declare function tryResolveModule(id: string, url: URL | URL[]): Promise<string | undefined>;
|
|
566
|
+
/** @deprecated pass URLs pointing at files */
|
|
567
|
+
declare function tryResolveModule(id: string, url: string | string[]): Promise<string | undefined>;
|
|
568
|
+
declare function resolveModule(id: string, options?: ResolveModuleOptions): string;
|
|
569
|
+
interface ImportModuleOptions extends ResolveModuleOptions {
|
|
570
|
+
/** Automatically de-default the result of requiring the module. */
|
|
571
|
+
interopDefault?: boolean;
|
|
572
|
+
}
|
|
573
|
+
declare function importModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T>;
|
|
574
|
+
declare function tryImportModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T | undefined> | undefined;
|
|
575
|
+
/**
|
|
576
|
+
* @deprecated Please use `importModule` instead.
|
|
577
|
+
*/
|
|
578
|
+
declare function requireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T;
|
|
579
|
+
/**
|
|
580
|
+
* @deprecated Please use `tryImportModule` instead.
|
|
581
|
+
*/
|
|
582
|
+
declare function tryRequireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T | undefined;
|
|
583
|
+
//#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 };
|