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

Commit

Permalink
chore: move deprecate hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 23, 2022
1 parent ccbac07 commit 1697d1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
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 @@ -30,12 +30,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

0 comments on commit 1697d1a

Please sign in to comment.