Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

refactor(nuxt)!: rename autoImports to imports #6864

Merged
merged 12 commits into from
Aug 23, 2022
Prev Previous commit
Next Next commit
chore: update
  • Loading branch information
antfu committed Aug 23, 2022
commit 27ed1e498923a3fcf9c227eaffc89ba3fe48f0da
12 changes: 6 additions & 6 deletions packages/kit/src/auto-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { assertNuxtCompatibility } from './compatibility'
export function addAutoImport (imports: Import | Import[]) {
assertNuxtCompatibility({ bridge: true })

useNuxt().hook('imports:extend', (imports) => {
imports.push(...(Array.isArray(imports) ? imports : [imports]))
useNuxt().hook('imports:extend', (extend) => {
extend.push(...(Array.isArray(imports) ? imports : [imports]))
})
}

export function addAutoImportDir (_autoImportDirs: string | string[]) {
export function addAutoImportDir (dirs: string | string[]) {
assertNuxtCompatibility({ bridge: true })

useNuxt().hook('imports:dirs', (autoImportDirs: string[]) => {
for (const dir of (Array.isArray(_autoImportDirs) ? _autoImportDirs : [_autoImportDirs])) {
autoImportDirs.push(dir)
useNuxt().hook('imports:dirs', (extend: string[]) => {
for (const dir of (Array.isArray(dirs) ? dirs : [dirs])) {
extend.push(dir)
}
})
}