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
Revert "chore: move deprecate hooks"
This reverts commit 9c5b034.
  • Loading branch information
pi0 committed Aug 23, 2022
commit 15c80aab823eff5a93f2377721dca4e87a593666
8 changes: 0 additions & 8 deletions packages/nuxt/src/core/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ 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: 6 additions & 0 deletions packages/nuxt/src/imports/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ 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