@nuxt/kit
Advanced tools
+78
-10
@@ -10,2 +10,3 @@ import * as _nuxt_schema from '@nuxt/schema'; | ||
| import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types'; | ||
| import { GlobOptions } from 'tinyglobby'; | ||
| import * as consola from 'consola'; | ||
@@ -23,6 +24,18 @@ import { ConsolaOptions } from 'consola'; | ||
| /** Installs a module on a Nuxt instance. */ | ||
| type ModuleToInstall = string | NuxtModule<ModuleOptions, Partial<ModuleOptions>, false>; | ||
| /** | ||
| * Installs a set of modules on a Nuxt instance. | ||
| * @internal | ||
| */ | ||
| declare function installModules(modulesToInstall: Map<ModuleToInstall, Record<string, any>>, resolvedModulePaths: Set<string>, nuxt?: Nuxt): Promise<void>; | ||
| /** | ||
| * Installs a module on a Nuxt instance. | ||
| * @deprecated Use module dependencies. | ||
| */ | ||
| 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>; | ||
| declare function getDirectory(p: string): string; | ||
| declare const normalizeModuleTranspilePath: (p: string) => string; | ||
| declare function resolveModuleWithOptions(definition: NuxtModule<any> | string | false | undefined | null | [(NuxtModule | string)?, Record<string, any>?], nuxt: Nuxt): { | ||
| resolvedPath?: string; | ||
| module: string | NuxtModule<any>; | ||
| options: Record<string, any>; | ||
| } | undefined; | ||
| declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{ | ||
@@ -33,2 +46,4 @@ nuxtModule: NuxtModule<any>; | ||
| }>; | ||
| declare function getDirectory(p: string): string; | ||
| declare const normalizeModuleTranspilePath: (p: string) => string; | ||
@@ -69,2 +84,37 @@ /** | ||
| interface LayerDirectories { | ||
| /** Nuxt rootDir (`/` by default) */ | ||
| readonly root: string; | ||
| /** Nitro source directory (`/server` by default) */ | ||
| readonly server: string; | ||
| /** Local modules directory (`/modules` by default) */ | ||
| readonly modules: string; | ||
| /** Shared directory (`/shared` by default) */ | ||
| readonly shared: string; | ||
| /** Public directory (`/public` by default) */ | ||
| readonly public: string; | ||
| /** Nuxt srcDir (`/app/` by default) */ | ||
| readonly app: string; | ||
| /** Layouts directory (`/app/layouts` by default) */ | ||
| readonly appLayouts: string; | ||
| /** Middleware directory (`/app/middleware` by default) */ | ||
| readonly appMiddleware: string; | ||
| /** Pages directory (`/app/pages` by default) */ | ||
| readonly appPages: string; | ||
| /** Plugins directory (`/app/plugins` by default) */ | ||
| readonly appPlugins: string; | ||
| } | ||
| /** | ||
| * Get the resolved directory paths for all layers in a Nuxt application. | ||
| * | ||
| * Returns an array of LayerDirectories objects, ordered by layer priority: | ||
| * - The first layer is the user/project layer (highest priority) | ||
| * - Earlier layers override later layers in the array | ||
| * - Base layers appear last in the array (lowest priority) | ||
| * | ||
| * @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context. | ||
| * @returns Array of LayerDirectories objects, ordered by priority (user layer first) | ||
| */ | ||
| declare function getLayerDirectories(nuxt?: _nuxt_schema.Nuxt): LayerDirectories[]; | ||
| declare function addImports(imports: Import | Import[]): void; | ||
@@ -302,3 +352,8 @@ declare function addImportsDir(dirs: string | string[], opts?: { | ||
| alias?: Record<string, string>; | ||
| /** The file extensions to try. Default is Nuxt configured extensions. */ | ||
| /** | ||
| * The file extensions to try. | ||
| * Default is Nuxt configured extensions. | ||
| * | ||
| * Isn't considered when `type` is set to `'dir'`. | ||
| */ | ||
| extensions?: string[]; | ||
@@ -312,11 +367,16 @@ /** | ||
| * Whether to fallback to the original path if the resolved path does not exist instead of returning the normalized input path. | ||
| * | ||
| * @default false | ||
| */ | ||
| fallbackToOriginal?: boolean; | ||
| /** | ||
| * The type of the path to be resolved. | ||
| * @default 'file' | ||
| */ | ||
| type?: PathType; | ||
| } | ||
| /** | ||
| * Resolve full path to a file or directory respecting Nuxt alias and extensions options | ||
| * Resolve the full path to a file or a directory (based on the provided type), respecting Nuxt alias and extensions options. | ||
| * | ||
| * If path could not be resolved, normalized input path will be returned | ||
| * If a path cannot be resolved, normalized input will be returned unless the `fallbackToOriginal` option is set to `true`, | ||
| * in which case the original input path will be returned. | ||
| */ | ||
@@ -327,3 +387,3 @@ declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>; | ||
| */ | ||
| declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: 'file' | 'dir'): Promise<string | null>; | ||
| declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: PathType): Promise<string | null>; | ||
| /** | ||
@@ -342,4 +402,12 @@ * Resolve path aliases respecting Nuxt alias options | ||
| declare function resolveNuxtModule(base: string, paths: string[]): Promise<string[]>; | ||
| type PathType = 'file' | 'dir'; | ||
| /** | ||
| * Resolve absolute file paths in the provided directory with respect to `.nuxtignore` and return them sorted. | ||
| * @param path path to the directory to resolve files in | ||
| * @param pattern glob pattern or an array of glob patterns to match files | ||
| * @param opts options for globbing | ||
| */ | ||
| declare function resolveFiles(path: string, pattern: string | string[], opts?: { | ||
| followSymbolicLinks?: boolean; | ||
| ignore?: GlobOptions['ignore']; | ||
| }): Promise<string[]>; | ||
@@ -468,3 +536,3 @@ | ||
| export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, runWithNuxtContext, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes }; | ||
| export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LoadNuxtConfigOptions, LoadNuxtOptions, ResolveModuleOptions, ResolvePathOptions, Resolver }; | ||
| export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, 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, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes }; | ||
| export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LayerDirectories, LoadNuxtConfigOptions, LoadNuxtOptions, ResolveModuleOptions, ResolvePathOptions, Resolver }; |
+78
-10
@@ -10,2 +10,3 @@ import * as _nuxt_schema from '@nuxt/schema'; | ||
| import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types'; | ||
| import { GlobOptions } from 'tinyglobby'; | ||
| import * as consola from 'consola'; | ||
@@ -23,6 +24,18 @@ import { ConsolaOptions } from 'consola'; | ||
| /** Installs a module on a Nuxt instance. */ | ||
| type ModuleToInstall = string | NuxtModule<ModuleOptions, Partial<ModuleOptions>, false>; | ||
| /** | ||
| * Installs a set of modules on a Nuxt instance. | ||
| * @internal | ||
| */ | ||
| declare function installModules(modulesToInstall: Map<ModuleToInstall, Record<string, any>>, resolvedModulePaths: Set<string>, nuxt?: Nuxt): Promise<void>; | ||
| /** | ||
| * Installs a module on a Nuxt instance. | ||
| * @deprecated Use module dependencies. | ||
| */ | ||
| 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>; | ||
| declare function getDirectory(p: string): string; | ||
| declare const normalizeModuleTranspilePath: (p: string) => string; | ||
| declare function resolveModuleWithOptions(definition: NuxtModule<any> | string | false | undefined | null | [(NuxtModule | string)?, Record<string, any>?], nuxt: Nuxt): { | ||
| resolvedPath?: string; | ||
| module: string | NuxtModule<any>; | ||
| options: Record<string, any>; | ||
| } | undefined; | ||
| declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{ | ||
@@ -33,2 +46,4 @@ nuxtModule: NuxtModule<any>; | ||
| }>; | ||
| declare function getDirectory(p: string): string; | ||
| declare const normalizeModuleTranspilePath: (p: string) => string; | ||
@@ -69,2 +84,37 @@ /** | ||
| interface LayerDirectories { | ||
| /** Nuxt rootDir (`/` by default) */ | ||
| readonly root: string; | ||
| /** Nitro source directory (`/server` by default) */ | ||
| readonly server: string; | ||
| /** Local modules directory (`/modules` by default) */ | ||
| readonly modules: string; | ||
| /** Shared directory (`/shared` by default) */ | ||
| readonly shared: string; | ||
| /** Public directory (`/public` by default) */ | ||
| readonly public: string; | ||
| /** Nuxt srcDir (`/app/` by default) */ | ||
| readonly app: string; | ||
| /** Layouts directory (`/app/layouts` by default) */ | ||
| readonly appLayouts: string; | ||
| /** Middleware directory (`/app/middleware` by default) */ | ||
| readonly appMiddleware: string; | ||
| /** Pages directory (`/app/pages` by default) */ | ||
| readonly appPages: string; | ||
| /** Plugins directory (`/app/plugins` by default) */ | ||
| readonly appPlugins: string; | ||
| } | ||
| /** | ||
| * Get the resolved directory paths for all layers in a Nuxt application. | ||
| * | ||
| * Returns an array of LayerDirectories objects, ordered by layer priority: | ||
| * - The first layer is the user/project layer (highest priority) | ||
| * - Earlier layers override later layers in the array | ||
| * - Base layers appear last in the array (lowest priority) | ||
| * | ||
| * @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context. | ||
| * @returns Array of LayerDirectories objects, ordered by priority (user layer first) | ||
| */ | ||
| declare function getLayerDirectories(nuxt?: _nuxt_schema.Nuxt): LayerDirectories[]; | ||
| declare function addImports(imports: Import | Import[]): void; | ||
@@ -302,3 +352,8 @@ declare function addImportsDir(dirs: string | string[], opts?: { | ||
| alias?: Record<string, string>; | ||
| /** The file extensions to try. Default is Nuxt configured extensions. */ | ||
| /** | ||
| * The file extensions to try. | ||
| * Default is Nuxt configured extensions. | ||
| * | ||
| * Isn't considered when `type` is set to `'dir'`. | ||
| */ | ||
| extensions?: string[]; | ||
@@ -312,11 +367,16 @@ /** | ||
| * Whether to fallback to the original path if the resolved path does not exist instead of returning the normalized input path. | ||
| * | ||
| * @default false | ||
| */ | ||
| fallbackToOriginal?: boolean; | ||
| /** | ||
| * The type of the path to be resolved. | ||
| * @default 'file' | ||
| */ | ||
| type?: PathType; | ||
| } | ||
| /** | ||
| * Resolve full path to a file or directory respecting Nuxt alias and extensions options | ||
| * Resolve the full path to a file or a directory (based on the provided type), respecting Nuxt alias and extensions options. | ||
| * | ||
| * If path could not be resolved, normalized input path will be returned | ||
| * If a path cannot be resolved, normalized input will be returned unless the `fallbackToOriginal` option is set to `true`, | ||
| * in which case the original input path will be returned. | ||
| */ | ||
@@ -327,3 +387,3 @@ declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>; | ||
| */ | ||
| declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: 'file' | 'dir'): Promise<string | null>; | ||
| declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: PathType): Promise<string | null>; | ||
| /** | ||
@@ -342,4 +402,12 @@ * Resolve path aliases respecting Nuxt alias options | ||
| declare function resolveNuxtModule(base: string, paths: string[]): Promise<string[]>; | ||
| type PathType = 'file' | 'dir'; | ||
| /** | ||
| * Resolve absolute file paths in the provided directory with respect to `.nuxtignore` and return them sorted. | ||
| * @param path path to the directory to resolve files in | ||
| * @param pattern glob pattern or an array of glob patterns to match files | ||
| * @param opts options for globbing | ||
| */ | ||
| declare function resolveFiles(path: string, pattern: string | string[], opts?: { | ||
| followSymbolicLinks?: boolean; | ||
| ignore?: GlobOptions['ignore']; | ||
| }): Promise<string[]>; | ||
@@ -468,3 +536,3 @@ | ||
| export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, runWithNuxtContext, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes }; | ||
| export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LoadNuxtConfigOptions, LoadNuxtOptions, ResolveModuleOptions, ResolvePathOptions, Resolver }; | ||
| export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, 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, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes }; | ||
| export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LayerDirectories, LoadNuxtConfigOptions, LoadNuxtOptions, ResolveModuleOptions, ResolvePathOptions, Resolver }; |
+9
-8
| { | ||
| "name": "@nuxt/kit", | ||
| "version": "4.0.3", | ||
| "version": "4.1.0", | ||
| "repository": { | ||
@@ -35,6 +35,7 @@ "type": "git", | ||
| "klona": "^2.0.6", | ||
| "mlly": "^1.7.4", | ||
| "mlly": "^1.8.0", | ||
| "ohash": "^2.0.11", | ||
| "pathe": "^2.0.3", | ||
| "pkg-types": "^2.2.0", | ||
| "pkg-types": "^2.3.0", | ||
| "rc9": "^2.1.2", | ||
| "scule": "^1.3.0", | ||
@@ -50,11 +51,11 @@ "semver": "^7.7.2", | ||
| "devDependencies": { | ||
| "@rspack/core": "1.4.11", | ||
| "@rspack/core": "1.5.2", | ||
| "@types/semver": "7.7.0", | ||
| "hookable": "5.5.3", | ||
| "nitropack": "2.12.4", | ||
| "unbuild": "3.6.0", | ||
| "vite": "7.0.6", | ||
| "unbuild": "3.6.1", | ||
| "vite": "7.1.4", | ||
| "vitest": "3.2.4", | ||
| "webpack": "5.101.0", | ||
| "@nuxt/schema": "4.0.3" | ||
| "webpack": "5.101.3", | ||
| "@nuxt/schema": "4.1.0" | ||
| }, | ||
@@ -61,0 +62,0 @@ "engines": { |
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
123144
14.24%2367
14.07%15
-11.76%22
4.76%+ Added
Updated
Updated