套件实用程序 Kit Utilities

提供可组合的实用程序来帮助与 Nuxt Hooks 和 Nuxt Builder 进行交互。

Modules 源码

  • installModule(module, inlineOptions)

程序化使用 源码

  • loadNuxt(loadOptions)
  • buildNuxt(nuxt)
  • loadNuxtConfig(loadOptions)

兼容性 源码

  • checkNuxtCompatibility(constraints)
  • assertNuxtCompatibility(constraints)
  • hasNuxtCompatibility(constraints)
  • isNuxt2()
  • isNuxt3()
  • getNuxtVersion()

自动导入 源码

  • addImports(imports)
  • addImportsDir(importDirs)
  • addImportsSources(importSources)

组件 源码

  • addComponentsDir(dir)
  • addComponent(componentObject)

Context 源码

  • useNuxt()

页面 源码

  • extendPages (callback: pages => void)
  • extendRouteRules (route: string, rule: NitroRouteConfig, options: ExtendRouteRulesOptions)
  • addRouteMiddleware (input: NuxtMiddleware | NuxtMiddleware[], options: AddRouteMiddlewareOptions)

Plugins 源码

  • addPlugin(pluginOptions, { append? })
  • addPluginTemplate(pluginOptions, { append? })

模版 源码

  • addTemplate(templateOptions)
  • updateTemplates({ filter?: ResolvedNuxtTemplate => boolean })

Nitro 源码

  • addServerHandler (handler)
  • addDevServerHandler (handler)
  • useNitro() (only usable after ready hook)
  • addServerPlugin
  • addPrerenderRoutes

Resolving 源码

  • resolvePath (path, resolveOptions?)
  • resolveAlias (path, aliases?)
  • findPath (paths, resolveOptions?)
  • createResolver (base)

Logging 源码

  • useLogger(scope?)

构建器 源码

  • extendWebpackConfig(callback, options?)
  • extendViteConfig(callback, options?)
  • addWebpackPlugin(webpackPlugin, options?)
  • addVitePlugin(vitePlugin, options?)