Nuxt/docs/content/3.api/4.advanced/2.kit.md
Yaël Guilloux dc47c64f14
docs: use nuxt 3 and website theme (#5479)
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: pooya parsa <pyapar@gmail.com>
Co-authored-by: Clément Ollivier <clement.o2p@gmail.com>
2022-10-06 11:15:30 +02:00

104 lines
2.5 KiB
Markdown

---
title: "Kit Utilities"
description: Nuxt Kit provides composable utilities to help interacting with Nuxt Hooks and Nuxt Builder.
---
# Kit Utilities
::ReadMore{link="/guide/going-further/kit"}
::
## Utilities
### Modules
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/module)
- `installModule(module, inlineOptions)`
### Programmatic Usage
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/loader)
- `loadNuxt(loadOptions)`
- `buildNuxt(nuxt)`
- `loadNuxtConfig(loadOptions)`
### Compatibility
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/compatibility.ts)
- `checkNuxtCompatibility(constraints)`
- `assertNuxtCompatibility(constraints)`
- `hasNuxtCompatibility(constraints)`
- `isNuxt2()`
- `isNuxt3()`
- `getNuxtVersion()`
### Auto-imports
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/imports.ts)
- `addImports(imports)`
- `addImportsDir(autoImportDirs)`
- `addImportsSources(autoImportSources)`
### Components
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/components.ts)
- `addComponentsDir(dir)`
- `addComponent(componentObject)`
### Context
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/context.ts)
- `useNuxt()`
### Plugins
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/plugin.ts)
- `addPlugin(pluginOptions, { append? })`
- `addPluginTemplate(pluginOptions, { append? })`
### Templates
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/template.ts)
- `addTemplate(templateOptions)`
### Nitro
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/nitro.ts)
- ~~`addServerMiddleware(serverMiddleware)`~~
- `addServerHandler (handler)`
- `addDevServerHandler (handler)`
- `useNitro()` (only usable after `ready` hook)
### Resolving
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/resolve.ts)
- `resolvePath (path, resolveOptions?)`
- `resolveAlias (path, aliases?)`
- `findPath (paths, resolveOptions?)`
- `createResolver (base)`
### Logging
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/logger.ts)
- `useLogger(scope?)`
### Builder
[source code](https://github.com/nuxt/framework/blob/main/packages/kit/src/build.ts)
- `extendWebpackConfig(callback, options?)`
- `extendViteConfig(callback, options?)`
- `addWebpackPlugin(webpackPlugin, options?)`
- `addVitePlugin(vitePlugin, options?)`