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: move deprecate hooks
  • Loading branch information
antfu committed Aug 23, 2022
commit 9c5b0343998334e135ee18e78df4266d5cd24d72
8 changes: 8 additions & 0 deletions packages/nuxt/src/core/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ import { initNitro } from './nitro'
export function createNuxt (options: NuxtOptions): Nuxt {
const hooks = createHooks<NuxtHooks>()

// TODO: remove deprecated hooks in stable
hooks.deprecateHooks({
// @ts-expect-error
'autoImports:sources': { to: 'imports:sources' },
'autoImports:dirs': { to: 'imports:dirs' },
'autoImports:extend': { to: 'imports:extend' }
})

const nuxt: Nuxt = {
_version: version,
options,
Expand Down
6 changes: 0 additions & 6 deletions packages/nuxt/src/imports/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ export default defineNuxtModule<Partial<ImportsOptions>>({
// @ts-ignore
options = defu(nuxt.options['auto-imports'], options)
}
nuxt.hooks.deprecateHooks({
// @ts-expect-error
'autoImports:sources': { to: 'imports:sources' },
'autoImports:dirs': { to: 'imports:dirs' },
'autoImports:extend': { to: 'imports:extend' }
})

// Allow modules extending sources
await nuxt.callHook('imports:sources', options.presets as ImportPresetWithDeprecation[])
Expand Down